module Enumerable
Public Instance Methods
map_with_index() { |item, i| ... }
click to toggle source
This map_with_index
hack allows access to the index of each item as the map iterates. TODO: Is there a better way?
# File lib/rarff.rb, line 27 def map_with_index # Ugly, but I need the yield to be the last statement in the map. i = -1 return map { |item| i += 1 yield item, i } end