From db11ef9546b1ad16cf539395b75450c1c8e9714c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 18 Apr 2008 14:50:10 -0700 Subject: Override Ruby 1.8.7's incompatible Symbol#to_proc. --- activesupport/lib/active_support/core_ext/symbol.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activesupport') 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: # -- cgit v1.2.3