class StateMachines::State
Public Instance Methods
draw(graph, options = {})
click to toggle source
Draws a representation of this state on the given machine. This will create a new node on the graph with the following properties:
-
label
- The human-friendly description of the state. -
width
- The width of the node. Always 1. -
height
- The height of the node. Always 1. -
shape
- The actual shape of the node. If the state is a final state, then “doublecircle”, otherwise “ellipse”.
Configuration options:
-
:human_name
- Whether to use the state's human name for the node's label that gets drawn on the graph
# File lib/state_machines/graphviz/monkeypatch.rb, line 85 def draw(graph, options = {}) node = graph.add_nodes(name ? name.to_s : 'nil', :label => description(options), :width => '1', :height => '1', :shape => final? ? 'doublecircle' : 'ellipse' ) # Add open arrow for initial state graph.add_edges(graph.add_nodes('starting_state', :shape => 'point'), node) if initial? true end