summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-23 03:35:38 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-23 03:35:38 +0000
commitc2204ca328817f3d87232471a4e1de0334425752 (patch)
treeb5489d0f829a520280292240aba2dc834f99af4f /string.c
parent827e71bda54ffab6e2b2e0434b235c6190055cdb (diff)
* 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
Diffstat (limited to 'string.c')
-rw-r--r--string.c34
1 files changed, 21 insertions, 13 deletions
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 <i>other_str</i> is greater than, 0 if
- * <i>other_str</i> is equal to, and +1 if <i>other_str</i> is less than
- * <i>str</i>. 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
- * <code>$=</code> allowed case-insensitive comparisons; this is now deprecated
- * in favor of using <code>String#casecmp</code>.
+ *
+ * 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.
*
* <code><=></code> is the basis for the methods <code><</code>,
- * <code><=</code>, <code>></code>, <code>>=</code>, and <code>between?</code>,
- * included from module <code>Comparable</code>. The method
- * <code>String#==</code> does not use <code>Comparable#==</code>.
+ * <code><=</code>, <code>></code>, <code>>=</code>, and
+ * <code>between?</code>, 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