Ruby 2.6.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Fiberクラス > yield
yield(*arg = nil) -> object
[permalink][rdoc]現在のファイバーの親にコンテキストを切り替えます。
コンテキストの切り替えの際に Fiber#resume に与えられた引数を yield メソッドは返します。
a = nil
f = Fiber.new do
a = Fiber.yield()
end
f.resume()
f.resume(:foo)
p a #=> :foo