mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

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
6 lines
120 B
Ruby
6 lines
120 B
Ruby
class Symbol
|
|
def to_proc
|
|
proc { |*args| args.shift.send(self, *args) }
|
|
end unless method_defined?(:to_proc)
|
|
end
|