提交 cfc94394 编写于 作者: J Jeremy Kemper

Explicitly delegate Chars#<=> to work around Kernel#<=> possibly ignoring method_missing

上级 85cc1fa6
......@@ -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 =~ /!$/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册