From c2204ca328817f3d87232471a4e1de0334425752 Mon Sep 17 00:00:00 2001 From: zzak Date: Sat, 23 Feb 2013 03:35:38 +0000 Subject: * array.c: Document #<=> return values and formatting * bignum.c: ditto * file.c: ditto * object.c: ditto * numeric.c: ditto * rational.c: ditto * string.c: ditto * time.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 3d4fd37b5a..cbfac397fc 100644 --- a/string.c +++ b/string.c @@ -2358,20 +2358,22 @@ rb_str_eql(VALUE str1, VALUE str2) /* * call-seq: - * str <=> other_str -> -1, 0, +1 or nil + * string <=> other_string -> -1, 0, +1 or nil * - * Comparison---Returns -1 if other_str is greater than, 0 if - * other_str is equal to, and +1 if other_str is less than - * str. If the strings are of different lengths, and the strings are - * equal when compared up to the shortest length, then the longer string is - * considered greater than the shorter one. In older versions of Ruby, setting - * $= allowed case-insensitive comparisons; this is now deprecated - * in favor of using String#casecmp. + * + * Comparison---Returns -1, 0, +1 or nil depending on whether +string+ is less + * than, equal to, or greater than +other_string+. + * + * +nil+ is returned if the two values are incomparable. + * + * If the strings are of different lengths, and the strings are equal when + * compared up to the shortest length, then the longer string is considered + * greater than the shorter one. * * <=> is the basis for the methods <, - * <=, >, >=, and between?, - * included from module Comparable. The method - * String#== does not use Comparable#==. + * <=, >, >=, and + * between?, included from module Comparable. The method + * String#== does not use Comparable#==. * * "abcdef" <=> "abcde" #=> 1 * "abcdef" <=> "abcdef" #=> 0 @@ -7946,9 +7948,15 @@ sym_succ(VALUE sym) /* * call-seq: * - * str <=> other -> -1, 0, +1 or nil + * symbol <=> other_symbol -> -1, 0, +1 or nil + * + * Compares +symbol+ with +other_symbol+ after calling #to_s on each of the + * symbols. Returns -1, 0, +1 or nil depending on whether +symbol+ is less + * than, equal to, or greater than +other_symbol+. + * + * +nil+ is returned if the two values are incomparable. * - * Compares _sym_ with _other_ in string form. + * See String#<=> for more information. */ static VALUE -- cgit v1.2.3