Class: DatashiftJourney::StateMachines::Sequence
- Inherits:
-
Object
- Object
- DatashiftJourney::StateMachines::Sequence
- Extended by:
- Forwardable
- Defined in:
- lib/datashift_journey/state_machines/sequence.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#entry_state ⇒ Object
Returns the value of attribute entry_state.
-
#exit_state ⇒ Object
Returns the value of attribute exit_state.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#split ⇒ Object
Returns the value of attribute split.
-
#states ⇒ Object
readonly
Returns the value of attribute states.
-
#trigger_method ⇒ Object
Returns the value of attribute trigger_method.
-
#trigger_value ⇒ Object
Returns the value of attribute trigger_value.
Instance Method Summary collapse
- #add_states(list) ⇒ Object
- #branch? ⇒ Boolean
-
#initialize(states, id: '', entry_state: nil, exit_state: nil, trigger_value: nil, trigger_method: nil, split: false) ⇒ Sequence
constructor
rubocop:disable Metrics/ParameterLists.
- #inspect ⇒ Object
- #split? ⇒ Boolean
- #split_entry_state ⇒ Object
Constructor Details
#initialize(states, id: '', entry_state: nil, exit_state: nil, trigger_value: nil, trigger_method: nil, split: false) ⇒ Sequence
rubocop:disable Metrics/ParameterLists
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 34 def initialize(states, id: '', entry_state: nil, exit_state: nil, trigger_value: nil, trigger_method: nil, split: false) @states = [*states] @id = id @entry_state = entry_state @exit_state = exit_state @trigger_method = trigger_method @trigger_value = trigger_value @split = split end |
Instance Attribute Details
#entry_state ⇒ Object
Returns the value of attribute entry_state.
23 24 25 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 23 def entry_state @entry_state end |
#exit_state ⇒ Object
Returns the value of attribute exit_state.
23 24 25 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 23 def exit_state @exit_state end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
21 22 23 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 21 def id @id end |
#split ⇒ Object
Returns the value of attribute split.
25 26 27 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 25 def split @split end |
#states ⇒ Object
Returns the value of attribute states.
23 24 25 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 23 def states @states end |
#trigger_method ⇒ Object
Returns the value of attribute trigger_method.
25 26 27 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 25 def trigger_method @trigger_method end |
#trigger_value ⇒ Object
Returns the value of attribute trigger_value.
25 26 27 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 25 def trigger_value @trigger_value end |
Instance Method Details
#add_states(list) ⇒ Object
45 46 47 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 45 def add_states(list) @states.concat(list.flatten) end |
#branch? ⇒ Boolean
57 58 59 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 57 def branch? !trigger_value.nil? end |
#inspect ⇒ Object
49 50 51 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 49 def inspect "#{self.class.name}(#{id}) - #{@states.inspect} [splitter = #{split?}]" end |
#split? ⇒ Boolean
53 54 55 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 53 def split? split == true end |
#split_entry_state ⇒ Object
61 62 63 64 |
# File 'lib/datashift_journey/state_machines/sequence.rb', line 61 def split_entry_state return nil unless split? states.first end |