summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2026-01-09 17:56:47 -0500
committerPeter Zhu <peter@peterzhu.ca>2026-01-10 09:31:35 -0500
commitf0f4a683b4dddf870491607396a564dec55a4d6e (patch)
tree7163430b3f1927627ff903d83a9ccfb8f3b103f3 /object.c
parent0b83346f1c1f6e54c344307c2ec5f9d0a6f80317 (diff)
[DOC] Improve docs for Module#<=
Diffstat (limited to 'object.c')
-rw-r--r--object.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/object.c b/object.c
index 8ec0dc50a6..0238fefbfe 100644
--- a/object.c
+++ b/object.c
@@ -1915,11 +1915,24 @@ rb_mod_eqq(VALUE mod, VALUE arg)
* call-seq:
* mod <= other -> true, false, or nil
*
- * Returns true if <i>mod</i> is a subclass of <i>other</i> or
- * is the same as <i>other</i>. Returns
- * <code>nil</code> if there's no relationship between the two.
- * (Think of the relationship in terms of the class definition:
- * "class A < B" implies "A < B".)
+ * Returns +true+ if +self+ is a descendant of +other+
+ * (+self+ is a subclass of +other+ or +self+ includes +other+) or
+ * if +self+ is the same as +other+:
+ *
+ * Float <= Numeric # => true
+ * Array <= Enumerable # => true
+ * Float <= Float # => true
+ *
+ * Returns +false+ if +self+ is an ancestor of +other+
+ * (+self+ is a superclass of +other+ or +self+ is included in +other+):
+ *
+ * Numeric <= Float # => false
+ * Enumerable <= Array # => false
+ *
+ * Returns +nil+ if there is no relationship between the two:
+ *
+ * Float <= Hash # => nil
+ * Enumerable <= String # => nil
*/
VALUE