Skip to content

Commit 005fba0

Browse files
[DOC] Tweaks for Module#<=>
1 parent 688350d commit 005fba0

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

object.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,14 +2012,26 @@ rb_mod_gt(VALUE mod, VALUE arg)
20122012

20132013
/*
20142014
* call-seq:
2015-
* module <=> other_module -> -1, 0, +1, or nil
2015+
* self <=> object -> -1, 0, +1, or nil
20162016
*
2017-
* Comparison---Returns -1, 0, +1 or nil depending on whether +module+
2018-
* includes +other_module+, they are the same, or if +module+ is included by
2019-
* +other_module+.
2017+
* Returns:
2018+
*
2019+
* - +-1+, if +self+ includes +object+, if or +self+ is a subclass of +object+.
2020+
* - +0+, if +self+ and +object+ are the same.
2021+
* - +1+, if +object+ includes +self+, or if +object+ is a subclass of +self+.
2022+
* - +nil+, if none of the above is true.
2023+
*
2024+
* Examples:
2025+
*
2026+
* # Class Array includes module Enumerable.
2027+
* Array <=> Enumerable # => -1
2028+
* Enumerable <=> Enumerable # => 0
2029+
* Enumerable <=> Array # => 1
2030+
* # Class File is a subclass of class IO.
2031+
* File <=> IO # => -1
2032+
* IO <=> File # => 1
2033+
* File <=> File # => 0
20202034
*
2021-
* Returns +nil+ if +module+ has no relationship with +other_module+, if
2022-
* +other_module+ is not a module, or if the two values are incomparable.
20232035
*/
20242036

20252037
static VALUE

0 commit comments

Comments
 (0)