るりまサーチ

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

別のキーワード

  1. _builtin each_object
  2. objectspace each_object
  3. object send
  4. object to_enum
  5. object public_send

ライブラリ

クラス

検索結果

Fiber.yield(*arg = nil) -> object (18215.0)

現在のファイバーの親にコンテキストを切り替えます。

... yield メソッドは返します。

@param arg 現在のファイバーの親に渡したいオブジェクトを指定します。

@raise FiberError Fiber でのルートファイバーで呼ばれた場合に発生します。


//emlist[例:][ruby]{
a = nil
f = Fiber.new do
a = Fiber.yield(...

Proc.new -> Proc (19.0)

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

...pturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しなければ、このメソッドを呼び出したメソッドが
ブロック...
...ist[例][ruby]{
def foo
yield
(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 (Argum...

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

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

...pturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しなければ、このメソッドを呼び出したメソッドが
ブロック...
...ist[例][ruby]{
def foo
yield
(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 (Argum...