15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/sgf/more/state_machine_presenter.rb', line 15
def process state_machine
nodes_hash[state_machine.start_state.to_s] = create_node(state_machine.start_state.to_s)
state_machine.transitions.each do |from_state, transitions|
transitions.each do |transition|
from_node = nodes_hash[from_state.to_s] ||= create_node(from_state.to_s)
to_state = transition.after_state || from_state
to_node = nodes_hash[to_state.to_s] ||= create_node(to_state.to_s)
transition_desc = transition.description || transition.event_pattern.inspect
edges << create_edge(from_node, to_node, transition_desc)
end
end
end
|