るりまサーチ

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

別のキーワード

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

ライブラリ

検索結果

Proc.new -> Proc (8026.0)

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

...OSE = true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError
(tried to create Proc object without a block)
が発生します。

ブロックを指定しなければ、こ...
...は明示的に & 引数でうけるべきです。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

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

これ...
...伴わなければ、例外
ArgumentError
が発生します。

//emlist[例][ruby]{
def foo
Proc
.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc
.new は、Proc#initialize が定義され...

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

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

...OSE = true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError
(tried to create Proc object without a block)
が発生します。

ブロックを指定しなければ、こ...
...は明示的に & 引数でうけるべきです。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

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

これ...
...伴わなければ、例外
ArgumentError
が発生します。

//emlist[例][ruby]{
def foo
Proc
.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc
.new は、Proc#initialize が定義され...
...se ArgumentError ブロックを省略した呼び出しを行ったときに発生します。

//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#i...
...nitialize が定義されていれば
オブジェクトの初期化のためにこれを呼び出します。このことを
除けば、Kernel.#proc と同じです。...