るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.043秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

検索結果

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

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

...[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 (3021.0)

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

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