TLX.Emitter.Graph (TLX v0.5.2)

Copy Markdown

Extracts state machine graph structure from a compiled TLX.Spec module.

Shared by all diagram emitters (DOT, Mermaid, PlantUML, D2). Returns a struct with states, edges, initial state, and module name.

Usage

graph = TLX.Emitter.Graph.extract(MySpec)
graph = TLX.Emitter.Graph.extract(MySpec, state_var: :status)

graph.states   #=> MapSet<[:idle, :running, :done]>
graph.edges    #=> [{:idle, :running, "start"}, ...]
graph.initial  #=> :idle
graph.name     #=> "MySpec"

Summary

Functions

Extract graph structure from a compiled spec module.

Functions

extract(module, opts \\ [])

Extract graph structure from a compiled spec module.

Options:

  • :state_var — name of the state variable (auto-detected if omitted)