るりまサーチ (Ruby 3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.229秒)
トップページ > クラス:Proc[x] > クエリ:_builtin[x] > クエリ:new[x] > 種類:特異メソッド[x] > バージョン:3.0[x]

別のキーワード

  1. _builtin inspect
  2. _builtin []
  3. _builtin to_s
  4. _builtin each

ライブラリ

検索結果

Proc.new { ... } -> Proc (78382.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...行ったときに発生します。

//emlist[][ruby]{
pr = Proc.new {|arg| p arg }
pr.call(1) # => 1
//}

//emlist[][ruby]{
Proc
.new # => -e:1:in `new': tried to create Proc object without a block (ArgumentError)
//}

Proc
.new は、Proc#initialize が定義されていれば
オブジェクトの...
...初期化のためにこれを呼び出します。このことを
除けば、Kernel.#proc と同じです。...