るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.090秒)
トップページ > クエリ:self[x] > クエリ:t[x] > クエリ:@[x] > クラス:Module[x] > クエリ:<=[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self=

ライブラリ

検索結果

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

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

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

継承関係にないクラス同士の比較では
nil を返します。

@
param other 比較対象...
...

@
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.ancestors #...
...=> [Foo, Baz]
Foo <= Baz # => false
Baz <= Foo # => true

Foo <= Foo # => true
Foo <= Object # => nil
//}...

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

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

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

self
と other を比較して、
self
が other の子孫であるとき -1、
同一のクラス/モジュールのとき 0、
self
が other の先祖であるとき 1
を返します。

継承関係にないクラス同士の比較では
n...
...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...
...# => -1
p Baz <=> Qux # => nil
p Qux <=> Baz # => nil

p Baz <=> Object.new # => nil
//}...