Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camillol/4070437 to your computer and use it in GitHub Desktop.
Save camillol/4070437 to your computer and use it in GitHub Desktop.
homebrew-pcc: work around Ruby 1.8.6's lack of Symbol#to_proc
Library/Homebrew/extend/symbol.rb | 7 +++++++
Library/Homebrew/global.rb | 1 +
2 files changed, 8 insertions(+)
create mode 100644 Library/Homebrew/extend/symbol.rb
diff --git a/Library/Homebrew/extend/symbol.rb b/Library/Homebrew/extend/symbol.rb
new file mode 100644
index 0000000..00ac103
--- /dev/null
+++ b/Library/Homebrew/extend/symbol.rb
@@ -0,0 +1,7 @@
+class Symbol
+ unless Symbol.method_defined?(:to_proc)
+ def to_proc
+ proc { |obj, *args| obj.send(self, *args) }
+ end
+ end
+end
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index d7071ea..2888126 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'
--
1.7.11.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment