Module: StateGate::Builder::TransitionMethods
- Included in:
- StateGate::Builder
- Defined in:
- lib/state_gate/builder/transition_methods.rb
Overview
Description
Multiple private methods allowing StateGate::Builder to generate transition methods.
-
query the class for all allowed transitions:
Klass.status_transitions #=> { pending: [:active], active: [:suspended, :archived], suspended: [:active, :archived], archived: [] }
-
query the class for the allowed transitions for the given state:
Klass.status_transitions_for(:pending) #=> [:active] Klass.status_transitions_for(:active) #=> [:suspended, :archived]
-
list the allowed transitions from the current state:
.status_transitions #=> [:suspended, :archived]
-
query if a given transition is allowed from the current state:
.status_transitions_to?(:active) #=> true