6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/conceptql/annotate_grapher.rb', line 6
def graph_it(statement, file_path, opts={})
raise "statement not annotated" unless statement.last[:annotation]
@counter = 0
output_type = opts.delete(:output_type) || File.extname(file_path).sub('.', '')
opts = opts.merge( type: :digraph )
g = GraphViz.new(:G, opts)
root = traverse(g, statement)
blank = g.add_nodes("_blank")
blank[:shape] = 'none'
blank[:height] = 0
blank[:label] = ''
blank[:fixedsize] = true
link_to(g, statement, root, blank)
g.output(output_type => file_path)
end
|