Method: Enumerable#map_with_index

Defined in:
lib/hobosupport/enumerable.rb

#map_with_indexObject



11
12
13
14
15
# File 'lib/hobosupport/enumerable.rb', line 11

def map_with_index
  res = []
  each_with_index {|x, i| res << yield(x, i)}
  res
end