aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-01-09 17:36:17 -0600
committerJack Nagel2013-01-09 17:36:17 -0600
commit67e8b5e215812a0582d8a7ab1853cd27ded737b7 (patch)
tree511e8e1172e119f4b1035750b1710c2a334f6612
parent9643ba6014783e3e055f4cf3af8a30a40c78d3d4 (diff)
downloadhomebrew-67e8b5e215812a0582d8a7ab1853cd27ded737b7.tar.bz2
Define Symbol#to_proc for Ruby 1.8.6
Ruby 1.8.6 doesn't have Symbol#to_proc, which allows things like map(&:to_s) rather than map { |o| o.to_s }. 1.8.7 does, though, and since it is used in a bunch of the superenv code we should attempt to keep it compatible with 1.8.6. Closes #16046.
-rw-r--r--Library/Homebrew/extend/symbol.rb5
-rw-r--r--Library/Homebrew/global.rb1
2 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/symbol.rb b/Library/Homebrew/extend/symbol.rb
new file mode 100644
index 000000000..75a17b5ad
--- /dev/null
+++ b/Library/Homebrew/extend/symbol.rb
@@ -0,0 +1,5 @@
+class Symbol
+ def to_proc
+ proc { |obj, *args| obj.send(self, *args) }
+ end unless method_defined?(:to_proc)
+end
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 2bc26cf68..6440506f8 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -2,6 +2,7 @@ require 'extend/fileutils'
require 'extend/pathname'
require 'extend/ARGV'
require 'extend/string'
+require 'extend/symbol'
require 'utils'
require 'exceptions'
require 'set'