るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.060秒)
トップページ > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:-[x] > クエリ:@[x] > クエリ:j[x] > クラス:Module[x] > クエリ:module_exec[x]

別のキーワード

  1. encoding windows_31j
  2. _builtin windows_31j
  3. _builtin cswindows31j
  4. encoding cswindows31j
  5. json j

ライブラリ

検索結果

Module#module_exec(*args) {|*vars| ... } -> object (15321.0)

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

...ル変数、定数とクラス変数のスコープはブロックの外側のスコープになります。

@
param args ブロックに渡す引数を指定します。


//emlist[例][ruby]{
class Thing
end
c = 1

Thing.class_exec{
def hello()
"Hello there!"
end

define_method(:foo) d...
...o # ローカル変数がブロックの外側を参照している
c
end
}

t = Thing.new
p t.hello() #=> "Hello there!"
p t.foo() #=> 1
//}

@
see Module#module_eval, Module#class_eval...

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

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

...ル変数、定数とクラス変数のスコープはブロックの外側のスコープになります。

@
param args ブロックに渡す引数を指定します。


//emlist[例][ruby]{
class Thing
end
c = 1

Thing.class_exec{
def hello()
"Hello there!"
end

define_method(:foo) d...
...o # ローカル変数がブロックの外側を参照している
c
end
}

t = Thing.new
p t.hello() #=> "Hello there!"
p t.foo() #=> 1
//}

@
see Module#module_eval, Module#class_eval...