diff options
author | Sam Elliott and Santiago Pastorino <lenary+santiago@wyeworks.com> | 2010-06-13 20:58:36 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-20 00:35:20 +0200 |
commit | 02ea1aa88ce92ee3fa0cc87c719f6fc6c1428bcc (patch) | |
tree | de356f741d65ebd5c71e83fb2fcd3017f8ce88fa /activesupport/lib | |
parent | f664c57fe854c230d25c448b941569b81860fa79 (diff) | |
download | rails-02ea1aa88ce92ee3fa0cc87c719f6fc6c1428bcc.tar.gz rails-02ea1aa88ce92ee3fa0cc87c719f6fc6c1428bcc.tar.bz2 rails-02ea1aa88ce92ee3fa0cc87c719f6fc6c1428bcc.zip |
<=> is defined twice on multibyte/chars.rb for Ruby < 1.9
[#4850 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/multibyte/chars.rb | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index d6ccb4bac1..a275176b4a 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -50,10 +50,6 @@ module ActiveSupport #:nodoc: 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 =~ /!$/ @@ -87,6 +83,16 @@ module ActiveSupport #:nodoc: include Comparable + # Returns <tt>-1</tt>, <tt>0</tt> or <tt>+1</tt> depending on whether the Chars object is to be sorted before, + # equal or after the object on the right side of the operation. It accepts any object that implements +to_s+. + # See <tt>String#<=></tt> for more details. + # + # Example: + # 'é'.mb_chars <=> 'ü'.mb_chars #=> -1 + def <=>(other) + @wrapped_string <=> other.to_s + end + if RUBY_VERSION < "1.9" # Returns +true+ if the Chars class can and should act as a proxy for the string _string_. Returns # +false+ otherwise. @@ -94,16 +100,6 @@ module ActiveSupport #:nodoc: $KCODE == 'UTF8' && consumes?(string) end - # Returns <tt>-1</tt>, <tt>0</tt> or <tt>+1</tt> depending on whether the Chars object is to be sorted before, - # equal or after the object on the right side of the operation. It accepts any object that implements +to_s+. - # See <tt>String#<=></tt> for more details. - # - # Example: - # 'é'.mb_chars <=> 'ü'.mb_chars #=> -1 - def <=>(other) - @wrapped_string <=> other.to_s - end - # Returns a new Chars object containing the _other_ object concatenated to the string. # # Example: |