class

FSM::Transition(T)

Inherits Reference < Object

A transition from one state to another on an event.

Transition(T) is a class, not a struct, with the same lifecycle as StateDefinition: the builder creates it, mutates it during build via on and guard, and it is read-only forever afterward while shared across every interpreter. Making it a class means the builder mutates one shared object rather than a copy, which is why registering a guard and a callback on the yielded transition takes effect. event and target are set at construction and never change; the only mutable surface is on and guard, which raise SealedStateError once the machine seals it.

Instance methods

event
Source
guard

Register the guard predicate that must return true for this transition to be selected.

Source
internal

Mark this transition internal. Chainable, so it reads as t.internal.on { ... }. Raises once sealed, like on and guard, because the internal flag is definition state and sealing means what you built is what runs.

Source
on

Register the transition callback fired during the transition.

Source
target
Source