Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#map_with_indexObject



2
3
4
5
6
7
8
# File 'lib/core_ext/array.rb', line 2

def map_with_index
  result = []
  each_with_index do |element, index|
    result << yield(element, index)
  end
  result
end