るりまサーチ

最速Rubyリファレンスマニュアル検索!
71件ヒット [1-71件を表示] (0.029秒)

別のキーワード

  1. module ancestors
  2. _builtin ancestors
  3. rb_mod_ancestors
  4. ancestors module
  5. ancestors _builtin

クラス

キーワード

検索結果

Module#ancestors -> [Class, Module] (18109.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_mo...

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

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

...承の代わりに用いられており、 mix-in とも呼びます。

//emlist[例][ruby]{
class C
include FileTest
include Math
end

p C.ancestors

# => [C, Math, FileTest, Object, Kernel]
//}

モジュールの機能追加は、クラスの継承関係の間にそのモジュールが挿...
...#ancestors の結果がメソッド探索の順序です)。

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

//emlist[例][ruby]{
module M
end
class C1
include M
end
class C2 < C1
include M # この include は無視される
end

p C2.ancestors...

Enumerator.produce(initial = nil) { |prev| ... } -> Enumerator (14.0)

与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。 ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。 initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック 呼び出しの引数として渡されます。initial が渡されなかった場合は nil が 渡されます。

...erator.produce { rand(10) }

# ツリー構造の祖先ノードを列挙する Enumerator
ancestors
= Enumerator.produce(node) { |prev| node = prev.parent or raise StopIteration }
enclosing_section = ancestors.find { |n| n.type == :section }
//}

このメソッドは Enumerable の各メソッド...

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

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

...odule#<

//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) -> bool | nil (14.0)

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

...; end
module Included
include Awesome
end
module Prepended
prepend Awesome
end

Included.ancestors # => [Included, Awesome]
Awesome > Included # => true
Included > Awesome # => false

Prepended.ancestors # => [Awesome, Prepended]
Awesome > Prepended # => true
Prepended > Awesome # => false

Awes...

絞り込み条件を変える

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

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

...odule#<

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

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

Module#included_modules -> [Module] (8.0)

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

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

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

module Outer
include Mixin
end

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

@see Module#ancestors...