Sha256: 995ff8c78c7d083b86c7947c64baa2522abec54947912b46bbc58c738e454a28

Contents?: true

Size: 257 Bytes

Versions: 6

Compression:

Stored size: 257 Bytes

Contents

# 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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facets-1.8.0 lib/facets/core/array/index.rb
facets-1.8.20 lib/facets/core/array/index.rb
facets-1.8.49 lib/facets/core/array/index.rb
facets-1.8.51 lib/facets/core/array/index.rb
facets-1.8.54 lib/facets/core/array/index.rb
facets-1.8.8 lib/facets/core/array/index.rb