[DOC] Harmonize #> methods

This commit is contained in:
Burdette Lamar 2026-01-09 16:36:26 -06:00 committed by GitHub
parent e08f316f28
commit 3d242a82a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 15 deletions

View File

@ -95,10 +95,13 @@ cmpint(VALUE x, VALUE y)
/* /*
* call-seq: * call-seq:
* obj > other -> true or false * self > other -> true or false
* *
* Compares two objects based on the receiver's <code><=></code> * Returns whether +self+ is "greater than" +other+;
* method, returning true if it returns a value greater than 0. * equivalent to <tt>(self <=> other) > 0</tt>:
*
* 'foo' > 'foo' # => false
* 'food' > 'foo' # => true
*/ */
static VALUE static VALUE

5
hash.c
View File

@ -4971,10 +4971,9 @@ rb_hash_ge(VALUE hash, VALUE other)
/* /*
* call-seq: * call-seq:
* self > other_hash -> true or false * self > other -> true or false
* *
* Returns +true+ if the entries of +self+ are a proper superset of the entries of +other_hash+, * Returns whether the entries of +self+ are a proper superset of the entries of +other+:
* +false+ otherwise:
* *
* h = {foo: 0, bar: 1, baz: 2} * h = {foo: 0, bar: 1, baz: 2}
* h > {foo: 0, bar: 1} # => true # Proper superset. * h > {foo: 0, bar: 1} # => true # Proper superset.

View File

@ -1638,7 +1638,8 @@ rb_float_cmp(VALUE x, VALUE y)
* call-seq: * call-seq:
* self > other -> true or false * self > other -> true or false
* *
* Returns +true+ if +self+ is numerically greater than +other+: * Returns whether the value of +self+ is greater than the value of +other+;
* +other+ must be numeric, but may not be Complex:
* *
* 2.0 > 1 # => true * 2.0 > 1 # => true
* 2.0 > 1.0 # => true * 2.0 > 1.0 # => true
@ -4958,7 +4959,8 @@ fix_gt(VALUE x, VALUE y)
* call-seq: * call-seq:
* self > other -> true or false * self > other -> true or false
* *
* Returns +true+ if the value of +self+ is greater than that of +other+: * Returns whether the value of +self+ is greater than the value of +other+;
* +other+ must be numeric, but may not be Complex:
* *
* 1 > 0 # => true * 1 > 0 # => true
* 1 > 1 # => false * 1 > 1 # => false

View File

@ -2009,14 +2009,23 @@ rb_mod_ge(VALUE mod, VALUE arg)
/* /*
* call-seq: * call-seq:
* mod > other -> true, false, or nil * self > other -> true, false, or nil
* *
* Returns true if <i>mod</i> is an ancestor of <i>other</i>. Returns * If +self+ is a class, returns +true+ if +self+ is a superclass of +other+,
* <code>false</code> if <i>mod</i> is the same as <i>other</i> * returns +false+ if +self+ is the same as +other+ or if +self+ is a subclass
* or <i>mod</i> is a descendant of <i>other</i>. * of +other+, and returns +nil+ if there are no relationship between the two:
* Returns <code>nil</code> if there's no relationship between the two. *
* (Think of the relationship in terms of the class definition: * Numeric > Float # => true
* "class A < B" implies "B > A".) * Float > Numeric # => false
* Float > Float # => false
* Float > Hash # => nil
*
* If +self+ is a module, returns +true+ if +other+ includes +self+,
* returns +false+ if +self+ is the same as +other+ or if +self+ includes
* +other+, and returns +nil+ if there are no relationship between the two:
*
* Enumerable > Array # => true
* Enumerable > String # => nil
* *
*/ */