struct

FSM::State

Inherits Struct < Value < Object

The runtime snapshot an interpreter returns.

State reports the outcome of one transaction, not the condition of an interpreter. By the time a snapshot exists the step is over, so there is no "running": id is the state the machine is in, status says whether the transaction committed, and error holds the exception on a failed step.

Construction must maintain the invariant that Failed carries an exception and Success does not. The types do not enforce it.

State is the immutable value read constantly in consumer code, so it holds the short name; the definition carries the longer StateDefinition. Nothing in a snapshot points back into the machine definition, so it is safe to return, compare, and cache.

Constructors

new(id : String, status : Status, error : Exception | Nil = nil)
Source

Instance methods

error
Source
status
Source