The ruby gem acts_as_state_machine can be super helpful for modeling object lifecycles within a flexible finite state machine framework. But I often find myself wanting a visual representation of the state transitions.
Is there a tool to generate an FSM diagram (state diagram flowchart, state/event table, UML, etc.) from an existing ruby class that acts_as_state_machine?
The
state_machinegem (not to be confused withacts_as_state_machine) has this functionality.For example, from the docs:
state_machineis no longer maintained. Its forkstate_machineshas extracted diagram functionality into a separate gem state_machines-graphviz. Installing that gem, and then run the renamed rake task: