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
This commit is contained in:
parent
9850e84f3b
commit
53a2558473
@ -1,5 +1,5 @@
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user