Class: Dynflow::DelayedExecutors::Abstract
- Inherits:
-
Object
- Object
- Dynflow::DelayedExecutors::Abstract
- Defined in:
- lib/dynflow/delayed_executors/abstract.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#core ⇒ Object
readonly
Returns the value of attribute core.
Instance Method Summary collapse
-
#initialize(world, options = {}) ⇒ Abstract
constructor
A new instance of Abstract.
- #spawn ⇒ Object
- #start ⇒ Object
- #started? ⇒ Boolean
- #terminate ⇒ Object
Constructor Details
#initialize(world, options = {}) ⇒ Abstract
Returns a new instance of Abstract.
8 9 10 11 12 13 |
# File 'lib/dynflow/delayed_executors/abstract.rb', line 8 def initialize(world, = {}) @world = world @options = @started = false spawn end |
Instance Attribute Details
#core ⇒ Object (readonly)
Returns the value of attribute core.
6 7 8 |
# File 'lib/dynflow/delayed_executors/abstract.rb', line 6 def core @core end |
Instance Method Details
#spawn ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/dynflow/delayed_executors/abstract.rb', line 29 def spawn Concurrent::Promises.resolvable_future.tap do |initialized| @core = core_class.spawn name: 'delayed-executor', args: [@world, @options], initialized: initialized end end |
#start ⇒ Object
19 20 21 22 23 |
# File 'lib/dynflow/delayed_executors/abstract.rb', line 19 def start @core.ask(:start).tap do @started = true end end |
#started? ⇒ Boolean
15 16 17 |
# File 'lib/dynflow/delayed_executors/abstract.rb', line 15 def started? @started end |
#terminate ⇒ Object
25 26 27 |
# File 'lib/dynflow/delayed_executors/abstract.rb', line 25 def terminate @core.ask(:terminate!) end |