Module: SimpleStateMachine::Tools::Graphviz
- Included in:
- StateMachineDefinition
- Defined in:
- lib/simple_state_machine/tools/graphviz.rb
Instance Method Summary collapse
-
#google_chart_url ⇒ Object
Generates a url that renders states and events as a directional graph.
-
#to_graphviz_dot ⇒ Object
Graphviz dot format for rendering as a directional graph.
Instance Method Details
#google_chart_url ⇒ Object
Generates a url that renders states and events as a directional graph. See code.google.com/apis/chart/docs/gallery/graphviz.html
14 15 16 17 18 |
# File 'lib/simple_state_machine/tools/graphviz.rb', line 14 def google_chart_url graph = transitions.map { |t| t.to_graphviz_dot }.sort.join(";") puts graph "http://chart.googleapis.com/chart?cht=gv&chl=digraph{#{::CGI.escape graph}}" end |
#to_graphviz_dot ⇒ Object
Graphviz dot format for rendering as a directional graph
6 7 8 9 10 |
# File 'lib/simple_state_machine/tools/graphviz.rb', line 6 def to_graphviz_dot "digraph G {\n" + transitions.map { |t| t.to_graphviz_dot }.sort.join(";\n") + "\n}" end |