るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. fiber alive?
  2. fiber transfer
  3. fiber current
  4. _builtin fiber

ライブラリ

クラス

キーワード

検索結果

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

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

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

コンテキストの切り替えの際に Fiber#resume に与えられた引数を yield メソッドは返します。

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

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


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

f.resume()
f.resume(:foo)

p a #=> :foo
//}

TracePoint.new(*events) {|obj| ... } -> TracePoint (58.0)

新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。

新しい TracePoint オブジェクトを作成して返します。トレースを有効
にするには TracePoint#enable を実行してください。

//emlist[例:irb で実行した場合][ruby]{
trace = TracePoint.new(:call) do |tp|
p [tp.lineno, tp.defined_class, tp.method_id, tp.event]
end
# => #<TracePoint:0x007f17372cdb20>

trace.enable
# => false

puts "Hello, TracePoint!"
# ....