324件ヒット
[301-324件を表示]
(0.063秒)
別のキーワード
ライブラリ
- ビルトイン (324)
キーワード
- < (12)
- <= (12)
- === (12)
- > (12)
- >= (12)
-
class
_ eval (24) -
class
_ exec (12) -
extend
_ object (12) - extended (12)
- include? (12)
-
instance
_ method (12) -
module
_ eval (24) -
module
_ exec (12) - prepend (12)
-
prepend
_ features (12) - public (48)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
singleton
_ class? (12) -
undef
_ method (12)
検索結果
先頭2件
-
Module
# class _ exec(*args) {|*vars| . . . } -> object (120.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...ュールのコンテキストで評価します。
モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ローカル変......[ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}
t = Thing.new
p t.hello() #=> "Hello there!"
p t.foo() #=> 1
//}
@see Module......#module_eval, Module#class_eval... -
Module
# module _ exec(*args) {|*vars| . . . } -> object (120.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...ュールのコンテキストで評価します。
モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ローカル変......[ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}
t = Thing.new
p t.hello() #=> "Hello there!"
p t.foo() #=> 1
//}
@see Module......#module_eval, Module#class_eval...