Sha256: 5d112363cc0a8abd6e1ca0b07094cfe6d993603a7f120aa7003584c97b42c7af

Contents?: true

Size: 206 Bytes

Versions: 2

Compression:

Stored size: 206 Bytes

Contents

class Array
  alias :old_index :index
  def index(*args, &block)
    if block_given?
      each_with_index { |v,i| return i if yield(v) }
      return nil
    else 
      old_index(*args)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tartan-0.2.0 lib/core_ext/array.rb
tartan-0.2.1 lib/core_ext/array.rb