Class: EventCore::FiberTask
- Inherits:
-
Object
- Object
- EventCore::FiberTask
- Defined in:
- lib/event_core.rb
Overview
Encapsulates state of an async task spun off from a fiber.
Instance Method Summary collapse
-
#done(result = nil) ⇒ Object
Mark yielded fiber ready for resumption.
-
#initialize(fiber_source) ⇒ FiberTask
constructor
A new instance of FiberTask.
Constructor Details
#initialize(fiber_source) ⇒ FiberTask
Returns a new instance of FiberTask.
265 266 267 |
# File 'lib/event_core.rb', line 265 def initialize(fiber_source) @fiber_source = fiber_source end |
Instance Method Details
#done(result = nil) ⇒ Object
Mark yielded fiber ready for resumption. If the task has a result supply that as argument to done(), and it will become the result of the yield.
271 272 273 |
# File 'lib/event_core.rb', line 271 def done(result=nil) @fiber_source.ready!(result) end |