From d540903ee77e81dd1ec3dec744273fbb394238fa Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Fri, 19 Dec 2025 12:45:36 +0000 Subject: [PATCH] [DOC] Harmonize <= methods --- compar.c | 11 ++++++++--- hash.c | 5 ++--- numeric.c | 9 +++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/compar.c b/compar.c index c577e4741f..eda7e83824 100644 --- a/compar.c +++ b/compar.c @@ -141,10 +141,15 @@ cmp_lt(VALUE x, VALUE y) /* * call-seq: - * obj <= other -> true or false + * self <= other -> true or false + * + * Returns whether +self+ is "less than or equal to" +other+; + * equivalent to (self <=> other) <= 0: + * + * 'foo' <= 'foo' # => true + * 'foo' <= 'food' # => true + * 'food' <= 'foo' # => false * - * Compares two objects based on the receiver's <=> - * method, returning true if it returns a value less than or equal to 0. */ static VALUE diff --git a/hash.c b/hash.c index 9e1555518e..3669f55d50 100644 --- a/hash.c +++ b/hash.c @@ -4888,10 +4888,9 @@ hash_le(VALUE hash1, VALUE hash2) /* * call-seq: - * self <= other_hash -> true or false + * self <= other -> true or false * - * Returns +true+ if the entries of +self+ are a subset of the entries of +other_hash+, - * +false+ otherwise: + * Returns whether the entries of +self+ are a subset of the entries of +other+: * * h0 = {foo: 0, bar: 1} * h1 = {foo: 0, bar: 1, baz: 2} diff --git a/numeric.c b/numeric.c index 3e770ceed3..a71060c55d 100644 --- a/numeric.c +++ b/numeric.c @@ -1738,7 +1738,8 @@ flo_lt(VALUE x, VALUE y) * call-seq: * self <= other -> true or false * - * Returns +true+ if +self+ is numerically less than or equal to +other+: + * Returns whether the value of +self+ is less than or equal to the value of +other+; + * +other+ must be numeric, but may not be Complex: * * 2.0 <= 3 # => true * 2.0 <= 3.0 # => true @@ -5081,10 +5082,10 @@ fix_le(VALUE x, VALUE y) /* * call-seq: - * self <= real -> true or false + * self <= other -> true or false * - * Returns +true+ if the value of +self+ is less than or equal to - * that of +other+: + * Returns whether the value of +self+ is less than or equal to the value of +other+; + * +other+ must be numeric, but may not be Complex: * * 1 <= 0 # => false * 1 <= 1 # => true