Class: StateMachines::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/state_machines/graphviz/monkeypatch.rb

Instance Method Summary collapse

Instance Method Details

#draw(graph, options = {}) ⇒ Object

Draws a representation of this event on the given graph. This will create 1 or more edges on the graph for each branch (i.e. transition) configured.

Configuration options:

  • :human_name - Whether to use the event’s human name for the node’s label that gets drawn on the graph



108
109
110
111
112
113
114
115
# File 'lib/state_machines/graphviz/monkeypatch.rb', line 108

def draw(graph, options = {})
  valid_states = machine.states.by_priority.map {|state| state.name}
  branches.each do |branch|
    branch.draw(graph, options[:human_name] ? human_name : name, valid_states)
  end

  true
end