Class: GDA::Visitors::Dot

Inherits:
Visitor
  • Object
show all
Defined in:
lib/gda/visitors/dot.rb

Constant Summary collapse

HEADER =
"digraph G { graph [rankdir = \"TB\"];"
"}"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io = StringIO.new) ⇒ Dot

Returns a new instance of Dot.



10
11
12
13
# File 'lib/gda/visitors/dot.rb', line 10

def initialize io = StringIO.new
  @stack  = []
  @buffer = io
end

Instance Attribute Details

#stackObject (readonly)

Returns the value of attribute stack.



8
9
10
# File 'lib/gda/visitors/dot.rb', line 8

def stack
  @stack
end

Instance Method Details

#accept(node) ⇒ Object



18
19
20
21
22
23
# File 'lib/gda/visitors/dot.rb', line 18

def accept node
  puts HEADER
  super
  puts FOOTER
  @buffer.string
end