diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-04-18 14:50:10 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-04-18 14:50:20 -0700 |
commit | db11ef9546b1ad16cf539395b75450c1c8e9714c (patch) | |
tree | 644d6ffe31abf902a269aba17cc25b7cb695ea6a /activesupport | |
parent | 7e5aa6569bc041238aafa5a400758c0a7536da93 (diff) | |
download | rails-db11ef9546b1ad16cf539395b75450c1c8e9714c.tar.gz rails-db11ef9546b1ad16cf539395b75450c1c8e9714c.tar.bz2 rails-db11ef9546b1ad16cf539395b75450c1c8e9714c.zip |
Override Ruby 1.8.7's incompatible Symbol#to_proc.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/symbol.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/symbol.rb b/activesupport/lib/active_support/core_ext/symbol.rb index 54f541ad9a..d41d47e70e 100644 --- a/activesupport/lib/active_support/core_ext/symbol.rb +++ b/activesupport/lib/active_support/core_ext/symbol.rb @@ -1,4 +1,11 @@ -unless :test.respond_to?(:to_proc) +# Remove 1.8.7's incompatible method. +if :to_proc.respond_to?(:to_proc) && [1] != ([[1, 2]].map(&:first) rescue false) + class Symbol + remove_method :to_proc + end +end + +unless :to_proc.respond_to?(:to_proc) class Symbol # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples: # |