Class: Stateoscope::Visualizer

Inherits:
Struct
  • Object
show all
Defined in:
lib/stateoscope/visualizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ Visualizer

Returns a new instance of Visualizer


5
6
7
8
# File 'lib/stateoscope/visualizer.rb', line 5

def initialize(graph)
  super
  parse_graph!
end

Instance Attribute Details

#graphObject

Returns the value of attribute graph

Returns:

  • (Object)

    the current value of graph


4
5
6
# File 'lib/stateoscope/visualizer.rb', line 4

def graph
  @graph
end

Instance Method Details

#output(filename) ⇒ Object


18
19
20
# File 'lib/stateoscope/visualizer.rb', line 18

def output(filename)
  @viz.output(pdf: "#{filename}.pdf")
end

#parse_graph!Object


10
11
12
13
14
15
16
# File 'lib/stateoscope/visualizer.rb', line 10

def parse_graph!
  @viz = GraphViz.new(:G, type: 'digraph')
  add_entry_point
  add_states
  add_entry_point_transition
  add_state_transitions
end