Skip to content
Snippets Groups Projects
Commit 53a25584 authored by Misty De Meo's avatar Misty De Meo
Browse files

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
parent 9850e84f
No related branches found
No related tags found
No related merge requests found
class Symbol
def to_proc
proc { |obj, *args| obj.send(self, *args) }
proc { |*args| args.shift.send(self, *args) }
end unless method_defined?(:to_proc)
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment