From 53a25584730eee0de460b05cafd12d3ac8910f35 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Sat, 8 Mar 2014 10:37:58 -0800 Subject: [PATCH] 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 --- Library/Homebrew/extend/symbol.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/extend/symbol.rb b/Library/Homebrew/extend/symbol.rb index 75a17b5ad7..18ccb31474 100644 --- a/Library/Homebrew/extend/symbol.rb +++ b/Library/Homebrew/extend/symbol.rb @@ -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