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_machine
gem (not to be confused withacts_as_state_machine
) has this functionality.For example, from the docs:
state_machine
is no longer maintained. Its forkstate_machines
has extracted diagram functionality into a separate gem state_machines-graphviz. Installing that gem, and then run the renamed rake task: