Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Fiber::SchedulerInterface#fiber

fiber(&block)

Implementation of the Fiber.schedule. The method is expected to immediately run passed block of code in a separate non-blocking fiber, and to return that Fiber.

Minimal suggested implementation is:

Example
def fiber(&block)
  Fiber.new(blocking: false, &block).tap(&:resume)
end