struct FlawlessState::State
 
  - FlawlessState::State
- Struct
- Value
- Object
Defined in:
flawless_state.crConstructors
- 
        .new(transitions = self.defined_states)
        
          transitions are a Hash(Symbol,Array(Symbol)which reprsent what a state is allowed to transitio to
Instance Method Summary
- 
        #build_transitions(definitions : Hash(Symbol, Array(Symbol)))
        
          Create the @state_pairs array of tuples. 
- #current_state : Symbol
- 
        #defined_states
        
          each key results in an array that can be transitioned into. 
- #is?(state : Symbol)
- #is_not?(state : Symbol)
- #state_pairs : Array({Symbol, Symbol})
- #state_pairs=(state_pairs : Array(Tuple(Symbol, Symbol)))
- 
        #terminal?(state : Symbol = @current_state)
        
          A state is termimal if it is has no valid states to transition to (empty arrays in #defined_states) States can be forced to other states with#transition_to!
- 
        #transition_to(new_state : Symbol)
        
          if a transition is permitted, make it, otherwise raise an exception 
- 
        #transition_to!(new_state : Symbol)
        
          force a transition without checking the validity of the new state 
Constructor Detail
transitions are a Hash(Symbol,Array(Symbol) which reprsent
what a state is allowed to transitio to
Instance Method Detail
Create the @state_pairs array of tuples.  Each tuple is a from_state to a to_state. #defined_states
would produce the following pairs.  Each each is an allowed to-> from set of states.
[{:new, :initialized},
 {:new, :ready},
 {:new, :complete},
 {:initialized, :ready},
 {:initialized, :complete},
 {:ready, :complete}]each key results in an array that can be transitioned into.
see #build_transitions
A state is termimal if it is has no valid states to transition to (empty arrays in #defined_states)
States can be forced to other states with #transition_to!
if a transition is permitted, make it, otherwise raise an exception
force a transition without checking the validity of the new state