class FSM::Machine
- FSM::Machine
- Reference
- Object
Overview
Represents a finite state machine.
@property id [String] The unique identifier of the state machine. @property states [Hash(String, State)] A collection of states associated with the state machine. @property initial_state [State] The initial state of the state machine. @property current_state [State] The current state of the state machine.
Defined in:
fsm/machine.crClass Method Summary
-
.create(id : String, states : Array(State))
Create a new state machine with the given identifier, states, and initial state.
-
.create(id : String, states : Array(State), &)
Create a new state machine with the given identifier, states, initial state, and execute a block to set up additional configurations.
Instance Method Summary
-
#id : String
The unique identifier of the state machine.
-
#states : Hash(String, State)
A collection of states associated with the state machine.
Class Method Detail
Create a new state machine with the given identifier, states, and initial state.
@param id [String] The unique identifier of the state machine. @param states [Array(State)] The states associated with the state machine. @param context [Hash(String, Any)] Optional initial data to be registered in the context. @yieldparam self [Machine] The machine instance to be configured.
Create a new state machine with the given identifier, states, initial state, and execute a block to set up additional configurations.
@param id [String] The unique identifier of the state machine. @param states [Array(State)] The states associated with the state machine. @param context [Hash(String, Any)] Optional initial data to be registered in the context. @yieldparam self [Machine] The machine instance to be configured.
Instance Method Detail
A collection of states associated with the state machine.