るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

検索結果

Proc (13.0)

ブロックをコンテキスト(ローカル変数のスコープやスタックフ レーム)とともにオブジェクト化した手続きオブジェクトです。

..._proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda() #=> :from_method
p test_block() #=> :from_block...
...、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェクトが定...