Class: Courgette::Graph2Dot

Inherits:
Object
  • Object
show all
Defined in:
lib/courgette/graph2dot.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Graph2Dot

Returns a new instance of Graph2Dot.



6
7
8
# File 'lib/courgette/graph2dot.rb', line 6

def initialize &block
  @dot = digraph &block
end

Instance Method Details

#load(graph) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/courgette/graph2dot.rb', line 10

def load graph
  calculate_distinct_namespaces graph.nodes
  set_colorscheme

  graph.nodes.each do |node|
    add_node node
  end

  graph.edges.each do |edge|
    add_edge edge
  end
end

#save(*args) ⇒ Object



23
24
25
# File 'lib/courgette/graph2dot.rb', line 23

def save *args
  dot.save *args
end