Class: Airflow::State
- Inherits:
-
Object
- Object
- Airflow::State
- Defined in:
- lib/async_flow/state.rb
Constant Summary collapse
- BG_RUNNER_TRANSITIONS =
{ init: :init, stop: :stopped, running: :running }.freeze
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(transitions) ⇒ State
constructor
A new instance of State.
- #state?(state) ⇒ Boolean
- #transition!(new_state) ⇒ Object
Constructor Details
#initialize(transitions) ⇒ State
Returns a new instance of State.
17 18 19 20 |
# File 'lib/async_flow/state.rb', line 17 def initialize(transitions) @transitions = transitions define_methods end |
Instance Attribute Details
#state ⇒ Object
Returns the value of attribute state.
15 16 17 |
# File 'lib/async_flow/state.rb', line 15 def state @state end |
Class Method Details
.bg_state ⇒ Object
11 12 13 |
# File 'lib/async_flow/state.rb', line 11 def self.bg_state new(BG_RUNNER_TRANSITIONS) end |
Instance Method Details
#state?(state) ⇒ Boolean
22 23 24 |
# File 'lib/async_flow/state.rb', line 22 def state?(state) public_send("#{state}?") end |
#transition!(new_state) ⇒ Object
26 27 28 |
# File 'lib/async_flow/state.rb', line 26 def transition!(new_state) public_send("#{new_state}!") end |