Class: EventCore::FiberTask

Inherits:
Object
  • Object
show all
Defined in:
lib/event_core.rb

Overview

Encapsulates state of an async task spun off from a fiber.

Instance Method Summary collapse

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