FSM::State
Represents a state within the finite state machine.
@property id [String] The unique identifier of the state. @property transitions [Hash(String, Transition)] A collection of transitions associated with the state. @property entry_callbacks [Callable(String, Context)?] Optional callback to be executed when entering the state. @property exit_callbacks [Callable(String, Context)?] Optional callback to be executed when exiting the state.
Class methods
Instance methods
Compare two states for equality based on their identifiers.
@param other [State] The state to compare with.
Get a list of all target states reachable through transitions from this state.
Register a new callback to be fired when entering this state.
@yieldparam event [String] The event triggering the entry callback. @yieldparam context [Context] The context associated with the state machine.
Register a new transition from this state to another state.
@param event [String] The event triggering the transition. @param target [String] The target state after the transition.
Register a new transition with a callback to be executed when the transition is made.
@param event [String] The event triggering the transition. @param target [String] The target state after the transition. @yieldparam event [String] The event triggering the transition. @yieldparam context [Context] The context associated with the state machine.
Register new callbacks to be fired when exiting this state.
@yieldparam event [String] The event triggering the exit callbacks. @yieldparam context [Context] The context associated with the state machine.