Misty De Meo 53a2558473 Symbol#to_proc: fix with arrays of arrays
Previously, with nested arrays, the Symbol#to_proc would iterate over
the first item in the nested array instead of the array itself, e.g.:

[[1,2], [3,4]].map(&:first) #=>
	NoMethodError: undefined method `first' for 1:Fixnum
2014-03-08 10:37:58 -08:00

6 lines
120 B
Ruby

class Symbol
def to_proc
proc { |*args| args.shift.send(self, *args) }
end unless method_defined?(:to_proc)
end