るりまサーチ

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

別のキーワード

  1. symbol slice
  2. symbol []
  3. win32ole cp_symbol
  4. tracer event_symbol
  5. _builtin symbol

ライブラリ

クラス

検索結果

Proc#parameters(lambda: nil) -> [object] (18156.0)

Proc オブジェクトの引数の情報を返します。

...す。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以下のような Symbol と、引数名を表す Symbol の 2 要素です。

: :req
必須の引数
: :opt
デフォルト値が指定されたオプショナルな引数
: :rest
*...
...&b|}
prc.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
//}

//emlist[lambda: の例][ruby]{
prc = proc{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters # => x]...
..., [:opt, :y], [:rest, :other
prc = proc{|x, y=42, *other|}
p prc.parameters(lambda: true) # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters(lambda: false) # => x], [:opt, :y], [:rest, :other
//}

@see Method#parameters, UnboundMethod#parameters...

Method#parameters -> [object] (18132.0)

Method オブジェクトの引数の情報を返します。

...。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に応じた以下のような Symbol と、仮引数の名前を表す Symbol の 2 要素です。
組み込みのメソッドでは、仮引数の名前が取れません。

: :req
必須の引数
: :o...
...t[例][ruby]{
m = Class.new{define_method(:m){|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}}.instance_method(:m)
m.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
File.method(:symlink).parameters #=> req
//}

@see Proc#parameters...
...st[例][ruby]{
m = Class.new{define_method(:m){|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}}.instance_method(:m)
m.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
File.method(:symlink).parameters #=> req
//}

@see Proc#parameters...

Proc#parameters -> [object] (18132.0)

Proc オブジェクトの引数の情報を返します。

...す。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以下のような Symbol と、引数名を表す Symbol の 2 要素です。

: :req
必須の引数
: :opt
デフォルト値が指定されたオプショナルな引数
: :rest
*...
...ck
& で指定されたブロック引数


//emlist[例][ruby]{
prc = lambda{|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}
prc.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
//}


@see Method#parameters, UnboundMethod#parameters...

Proc#hash -> Integer (37.0)

self のハッシュ値を返します。

... Symbol と、引数名を表す Symbol の 2 要素です。

//emlist[][ruby]{
prc = proc{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = proc{|x, y=42, *other|}
p prc.parameters(la...
...mbda: true) # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters(lambda: false) # => x], [:opt, :y], [:rest, :other
//}...