2件ヒット
[1-2件を表示]
(0.145秒)
クラス
- Module (2)
検索結果
-
Module
# ancestors -> [Class , Module] (72982.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
# include(*mod) -> self (18715.0) -
モジュール mod をインクルードします。
モジュール mod をインクルードします。
@param mod Module のインスタンス( Enumerable など)を指定します。
@raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。
//emlist[例][ruby]{
module M
end
module M2
include M
end
module M
include M2
end
//}
実行結果:
-:3:in `append_features': cyclic include detected (ArgumentError)
...