Permalink
Browse files

Override Ruby 1.8.7's incompatible Symbol#to_proc.

  • Loading branch information...
jeremy committed Apr 18, 2008
1 parent 7e5aa65 commit db11ef9546b1ad16cf539395b75450c1c8e9714c
Showing with 8 additions and 1 deletion.
  1. +8 −1 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:
#

0 comments on commit db11ef9

Please sign in to comment.