Class: Array

Inherits:
Object show all
Defined in:
lib/nutella/core_ext/enumerable/map.rb

Overview

TODO: See if there is a DRYer way to make this work with Array also. Array doesn’t inherit Enumerable’s #map, so I’m forced to do this. Is there a better way to make Array inherit the modified #map?

Instance Method Summary collapse

Instance Method Details

#map(*args, &block) ⇒ Object

Allows mapping of a method with parameters across an array.

See Also:



27
28
29
# File 'lib/nutella/core_ext/enumerable/map.rb', line 27

def map(*args, &block)
  block_given? ? old_map(&block) : old_map { |elem| elem.send *args }
end

#old_mapObject



22
# File 'lib/nutella/core_ext/enumerable/map.rb', line 22

alias old_map map