Permalink
Browse files

Explicitly delegate Chars#<=> to work around Kernel#<=> possibly igno…

…ring method_missing
  • Loading branch information...
1 parent 85cc1fa commit cfc9439454988a07451a7e261379569d135bcef5 @jeremy jeremy committed Jun 11, 2010
Showing with 4 additions and 3 deletions.
  1. +4 −3 activesupport/lib/active_support/multibyte/chars.rb
@@ -34,7 +34,6 @@ module Multibyte #:nodoc:
#
# ActiveSupport::Multibyte.proxy_class = CharsForUTF32
class Chars
-
attr_reader :wrapped_string
alias to_s wrapped_string
alias to_str wrapped_string
@@ -45,14 +44,16 @@ def initialize(string)
@wrapped_string = string
@wrapped_string.force_encoding(Encoding::UTF_8) unless @wrapped_string.frozen?
end
-
- undef <=>
else
def initialize(string) #:nodoc:
@wrapped_string = string
end
end
+ def <=>(other)
+ @wrapped_string <=> other
+ end
+
# Forward all undefined methods to the wrapped string.
def method_missing(method, *args, &block)
if method.to_s =~ /!$/

0 comments on commit cfc9439

Please sign in to comment.