# TODO Remove Array#index when future Ruby has it.

class Array

  alias :index_of :index

  # Allows block usage with index.

  def index(obj=nil,&blk)
    return index_of(obj) unless block_given?
    i=0; i+=1 until yield(self[i])
    return i
  end

end
