種類
- インスタンスメソッド (66)
- 文書 (37)
- 関数 (11)
- 特異メソッド (5)
ライブラリ
- ビルトイン (71)
クラス
- Enumerator (5)
- Module (66)
キーワード
- <= (11)
- > (11)
- >= (11)
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 3
. 0 . 0 (4) - include (11)
-
included
_ modules (11) - produce (5)
-
rb
_ mod _ ancestors (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 9 feature (11)
検索結果
先頭5件
-
Module
# ancestors -> [Class , Module] (18107.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... -
VALUE rb
_ mod _ ancestors(VALUE mod) (6100.0) -
モジュール mod にインクルードされているモジュール、 さらに mod がクラスならばスーパークラスとそれに インクルードされているモジュールを再帰的に集めて メソッド探索優先順位順に並べて返します (早く探索されるほうが前)。
モジュール mod にインクルードされているモジュール、
さらに mod がクラスならばスーパークラスとそれに
インクルードされているモジュールを再帰的に集めて
メソッド探索優先順位順に並べて返します (早く探索されるほうが前)。 -
Module
# include(*mod) -> self (18.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... -
NEWS for Ruby 2
. 1 . 0 (18.0) -
NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...表します
* toplevel
* main.using はもはや実験的な機能ではありません。
The method activates refinements in the ancestors of the argument module to
support refinement inheritance by Module#include
=== 組み込みクラスの互換性 (機能追加とバグ修......。
Object#tainted?,Object#taint,Object#untaint とそれぞれ同じ動作です。
* Module#ancestors
* 特異クラスの祖先はそれ自身を含みます。
The ancestors of a singleton class now include singleton classes,
in particular itself.
* Module#define_meth... -
Enumerator
. produce(initial = nil) { |prev| . . . } -> Enumerator (12.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 (12.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 (12.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 (12.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] (6.0) -
self にインクルードされているモジュールの配列を返します。
...self にインクルードされているモジュールの配列を返します。
//emlist[例][ruby]{
module Mixin
end
module Outer
include Mixin
end
Mixin.included_modules #=> []
Outer.included_modules #=> [Mixin]
//}
@see Module#ancestors... -
NEWS for Ruby 3
. 0 . 0 (6.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...hod now returns the defined alias as a symbol. 17314
//emlist[][ruby]{
class C; end
module M1; end
module M2; end
C.include M1
M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}
* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change shoul... -
ruby 1
. 6 feature (6.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...include されないようになりました。
module Foo; end
module Bar; include Foo; end
module Foo; include Bar; end
p Foo.ancestors
=> ruby 1.6.6 (2001-12-26) [i586-linux]
[Foo, Bar, Foo]
=> -:3:in `append_features': cyclic include detected (ArgumentError)...