class
FSM::Builder(T)
- FSM::Builder(T)
- Reference
- Object
Overview
The machine-scoped builder yielded by Machine(T).build.
#state infers T from the enclosing builder, so T is named once per machine.
A partially-built StateDefinition never escapes the block as a loose local:
the builder registers it internally and seals it at the end of the block, which
is what closes the window in which a caller could hold an unsealed state.
At the end of the block finish validates every transition
target, seals every definition, and returns the immutable machine.
No two states share an id: registering a second state with an already-registered
id raises DuplicateStateError at that #state call rather than silently overwriting
the first definition and discarding its transitions.
Defined in:
fsm/builder.crConstructors
Instance Method Summary
-
#state(id : String, &) : StateDefinition(T)
Register a state, yielding its definition so transitions and callbacks can be attached.
Constructor Detail
Instance Method Detail
Register a state, yielding its definition so transitions and callbacks can be attached. The definition is registered regardless of what the block returns. Raises DuplicateStateError if id was already registered by this builder.