22件ヒット
[1-22件を表示]
(0.446秒)
検索結果
先頭2件
-
Module
# module _ exec(*args) {|*vars| . . . } -> object (23108.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...に渡す引数を指定します。
//emlist[例][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 t... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (8008.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...に渡す引数を指定します。
//emlist[例][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 t...