るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.038秒)
トップページ > クラス:Module[x] > クエリ:module[x] > クエリ:class_eval[x] > クエリ:class_exec[x]

別のキーワード

  1. argf.class lines
  2. argf.class each_line
  3. argf.class each
  4. argf.class readline
  5. argf.class readlines

ライブラリ

検索結果

Module#class_exec(*args) {|*vars| ... } -> object (27133.0)

与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。

...ing.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 (15133.0)

与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。

...ing.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...