るりまサーチ (Ruby 2.5.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.022秒)
トップページ > クラス:Module[x] > バージョン:2.5.0[x] > クエリ:Module#<[x]

別のキーワード

  1. module attr
  2. module new
  3. module constants
  4. erb def_module
  5. module module_eval

ライブラリ

キーワード

検索結果

Module#<(other) -> bool | nil (69004.0)

比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。

...list[例][ruby]{
module
Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar < Foo # => true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => nil
p Baz > Qux # => nil

p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//...

Module#<=(other) -> bool | nil (9004.0)

比較演算子。self が other の子孫であるか、self と other が 同一クラスである場合、 true を返します。 self が other の先祖である場合、false を返します。

...クラス

@raise TypeError other がクラスやモジュールではない場合に発生します。

@see Module#<

//emlist[例][ruby]{
module
Foo; end
module
Bar
include Foo
end
module
Baz
prepend Foo
end

Bar.ancestors # => [Bar, Foo]
Foo <= Bar # => false
Bar <= Foo # => true

Baz.ancest...

Module#<=>(other) -> Integer | nil (9004.0)

self と other の継承関係を比較します。

...がクラスやモジュールでなければ
nil を返します。

@param other 比較対象のクラスやモジュール

//emlist[例][ruby]{
module
Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar <=> Foo # => -1
p Baz <=> Bar # => -1
p Baz <=> Foo # =>...