るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. module attr
  2. module constants
  3. module new
  4. module module_eval
  5. module class_eval

ライブラリ

キーワード

検索結果

Module#ancestors -> [Class, Module] (186664.0)

クラス、モジュールのスーパークラスとインクルードしているモジュール を優先順位順に配列に格納して返します。

...順位順に配列に格納して返します。

//emlist[例][ruby]{
module
Foo
end
class Bar
include Foo
end
class Baz < Bar
p ancestors
p included_modules
p superclass
end
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}

@see Module#included_modules...

Module#included_modules -> [Module] (81697.0)

self にインクルードされているモジュールの配列を返します。

...self にインクルードされているモジュールの配列を返します。

//emlist[例][ruby]{
module
Mixin
end

module
Outer
include Mixin
end

Mixin.included_modules #=> []
Outer.included_modules #=> [Mixin]
//}

@see Module#ancestors...

Module#include(*mod) -> self (63184.0)

モジュール mod をインクルードします。

...ます。

@param mod Module のインスタンス( Enumerable など)を指定します。

@raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。

//emlist[例][ruby]{
module
M
end
module
M2
include M
end
module
M
include M2
end
//}...
...ールのほうが
先に行われます
(上の例の Module#ancestors の結果がメソッド探索の順序です)。

同じモジュールを二回以上 include すると二回目以降は無視されます。

//emlist[例][ruby]{
module
M
end
class C1
include M
end
class C2 < C1
include...

Module#<=(other) -> bool | nil (63112.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) -> bool | nil (63112.0)

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

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

@see Module#<

//emlist[例][ruby]{
module
Awesome; end
module
Included
include Awesome
end
module
Prepended
prepend Awesome
end

Included.ancestors # => [Included, Awesome]
Awesome > Included # => tr...

絞り込み条件を変える

Module#>=(other) -> bool | nil (63112.0)

比較演算子。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 # => true
Bar >= Foo # => false

Baz.ancest...