るりまサーチ

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

別のキーワード

  1. rake empty_task_args
  2. fiddle args
  3. closure args
  4. _builtin args
  5. optparse args

ライブラリ

キーワード

検索結果

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

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

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

モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの...
...実行されます。

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

@param 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 there!"
p t.foo() #=> 1
//}

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

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

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

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

モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの...
...実行されます。

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

@param 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 there!"
p t.foo() #=> 1
//}

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

Module#ruby2_keywords(method_name, ...) -> nil (29.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...ames, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, the final hash argum...
...check that the module responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
method will change so that it does not pass through keywords.

//emlist[例][ruby]{
module
Mod
def foo(meth, *args, &block)
send(:"do_#{meth}", *args, &block)
e...