class

FSM::Machine

Inherits Reference < Object

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.

Class methods

create(id : String, states : Array(State))

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.

Source
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.

@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.

Source

Instance methods

id

The unique identifier of the state machine.

Source
states

A collection of states associated with the state machine.

Source