self < other -> bool | nil[permalink][rdoc][edit]-
比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。
継承関係にないクラス同士の比較では nil を返します。
- [PARAM]
other: - 比較対象のモジュールやクラス
- [EXCEPTION]
TypeError: - other がクラスやモジュールではない場合に発生します。
module Flyable end class Bird include Flyable end class Eagle < Bird end class Fish end p Bird < Flyable # => true p Eagle < Bird # => true p Eagle < Flyable # => true p Eagle < Fish # => nil p Eagle > Fish # => nil Flyable < Object.new # => in `<': compared with non class/module (TypeError) - [PARAM]