summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-09 13:43:36 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-09 13:43:36 +0000
commitd91932948cc02065eb3d1ed6d018e42a4e5c0caf (patch)
treeb884d651c64d893372443816d335dc6b16ff5726 /object.c
parentcda3c63c7d20e26a6e3606bd4e63ad1621226cec (diff)
merge revision(s) 39414:
* object.c (rb_obj_comp): Documenting Object#<=> return values Patch by Stefan Rusterholz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/object.c b/object.c
index ceee4d47eb..76ff316543 100644
--- a/object.c
+++ b/object.c
@@ -1320,6 +1320,17 @@ rb_obj_not_match(VALUE obj1, VALUE obj2)
* obj <=> other -> 0 or nil
*
* Returns 0 if obj === other, otherwise nil.
+ *
+ * The <=> is used by various methods to compare objects, for example
+ * Enumerable#sort, Enumerable#max etc.
+ *
+ * Your implementation of <=> should return one of the following values: -1, 0,
+ * 1 or nil. -1 means self is smaller than other. 0 means self is equal to other.
+ * 1 means self is bigger than other. Nil means the two values could not be
+ * compared.
+ *
+ * When you defined <=>, you can include Comparable to gain the methods <=, <,
+ * ==, >=, > and between?.
*/
static VALUE
rb_obj_cmp(VALUE obj1, VALUE obj2)