... continued

This lesson continues the discussion on working with Fibers in Ruby.

We'll cover the following...

Yielding from Fibers

In the previous lesson, we used fibers much like function calls but the true potential of fibers is truly unleashed, when used with Fiber.yield. Don't confuse Fiber.yield with yield, the latter is used to execute arbitrary blocks of code. The Fiber.yield serves two purposes:

  • Returns control back to the invoker of the resume() method on the fiber.

  • Return a value to the invoker. ...