Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Module#<

(::Module other) -> bool?
self < other → true, false, or nil

Returns true if self is a descendant of other (self is a subclass of other or self includes other):

Example
Float < Numeric    # => true
Array < Enumerable # => true

Returns false if self is an ancestor of other (self is a superclass of other or self is included in other) or if self is the same as other:

Example
Numeric < Float    # => false
Enumerable < Array # => false
Float < Float      # => false

Returns nil if there is no relationship between the two:

Example
Float < Hash        # => nil
Enumerable < String # => nil
See also #<= .used_refinements .used_modules #<=> also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0