55件ヒット
[1-55件を表示]
(0.037秒)
別のキーワード
種類
- インスタンスメソッド (33)
- 文書 (22)
ライブラリ
- ビルトイン (33)
クラス
- Module (33)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (11) - include (11)
- included (11)
-
ruby 1
. 6 feature (11)
検索結果
先頭5件
-
Module
# append _ features(module _ or _ class) -> self (18254.0) -
モジュール(あるいはクラス)に self の機能を追加します。
...いはクラス)に self の機能を追加します。
このメソッドは Module#include の実体であり、
include を Ruby で書くと以下のように定義できます。
//emlist[例][ruby]{
def include(*modules)
modules.reverse_each do |mod|
# append_features や included は......プライベートメソッドなので
# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append_features, self)
mod.__send__(:included, self)
end
end
//}
@see Module#included... -
Module
# include(*mod) -> self (107.0) -
モジュール mod をインクルードします。
...合に発生します。
//emlist[例][ruby]{
module M
end
module M2
include M
end
module M
include M2
end
//}
実行結果:
-:3:in `append_features': cyclic include detected (ArgumentError)
from -:3:in `include'
from -:3
インクルードとは、指定されたモ... -
ruby 1
. 6 feature (84.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...の戻り値
以下のメソッドの戻り値が正しくなりました。((<ruby-bugs-ja:PR#205>))
* ((<Enumerable/each_with_index>)) が self を返すようになった(以前は nil)
* ((<Process/Process.setpgrp>)) が返す値が不定だった。
* ((<String/ljust>)), ((<String/rju......なくても常に dup した文字列を返すようになった
: 2002-03-08 class variable
((<ruby-talk:35122>))
class C
class << self
def test
@@cv = 5
p @@cv
end
end
test
end
=> -:5:in `test': uninitialized class variable @......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)
from -:3:in `include'
from -:3
ruby 1.6.6 (2002-01-28) [i586-linux]... -
Module
# included(class _ or _ module) -> () (34.0) -
self が Module#include されたときに対象のクラスまたはモジュー ルを引数にしてインタプリタがこのメソッドを呼び出します。
...
self が Module#include されたときに対象のクラスまたはモジュー
ルを引数にしてインタプリタがこのメソッドを呼び出します。
@param class_or_module Module#include を実行したオブジェクト
//emlist[例][ruby]{
module Foo
def self.included(mod)......p "#{mod} include #{self}"
end
end
class Bar
include Foo
end
# => "Bar include Foo"
//}
@see Module#append_features... -
NEWS for Ruby 2
. 0 . 0 (18.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...モジュールを self の継承チェインの先頭に
「追加する」ことで self の定数、メソッド、モジュール変数を「上書き」します。
* 追加: Module.prepended, Module.prepend_features は Module.included と Module.append_features に似ています...