<=> is defined twice on multibyte/chars.rb for Ruby < 1.9

[#4850 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Sam Elliott and Santiago Pastorino
2010-06-13 20:58:36 -03:00
committed by José Valim
parent f664c57fe8
commit 02ea1aa88c

View File

@@ -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: