るりまサーチ (Ruby 2.5.0)

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer chr
  5. integer new

ライブラリ

キーワード

検索結果

Proc#arity -> Integer (310.0)

Proc オブジェクトが受け付ける引数の数を返します。

...
Proc
オブジェクトが受け付ける引数の数を返します。

ただし、可変長引数を受け付ける場合、負の整数

-(必要とされる引数の数 + 1)

を返します。

//emlist[例][ruby]{
lambda{ }.arity # => 0
lambda{|| }.arity # => 0
lambd...

Proc#hash -> Integer (310.0)

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

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



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

Proc
オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以...
...を表す 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(lambda: true) # => x], [...

Proc#source_location -> [String, Integer] | nil (310.0)

ソースコードのファイル名と行番号を配列で返します。

...mlist[例][ruby]{
# /path/to/target.rb を実行
proc
{}.source_location # => ["/path/to/target.rb", 1]
proc
{}.source_location # => ["/path/to/target.rb", 2]
(eval "proc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location # => nil
//}

@see Method#sour...