Class: VisualizeRuby::Graphviz

Inherits:
Object
  • Object
show all
Defined in:
lib/visualize_ruby/graphviz.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graphs, label: nil) ⇒ Graphviz

Returns a new instance of Graphviz.



7
8
9
10
# File 'lib/visualize_ruby/graphviz.rb', line 7

def initialize(graphs, label: nil)
  @graphs = [*graphs]
  @label  = label
end

Instance Attribute Details

#graphsObject (readonly)

Returns the value of attribute graphs.



5
6
7
# File 'lib/visualize_ruby/graphviz.rb', line 5

def graphs
  @graphs
end

#labelObject (readonly)

Returns the value of attribute label.



5
6
7
# File 'lib/visualize_ruby/graphviz.rb', line 5

def label
  @label
end

Instance Method Details

#to_graph(type: :digraph, **output) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/visualize_ruby/graphviz.rb', line 12

def to_graph(type: :digraph, **output)
  g          = main_graph(type)
  sub_graphs = sub_graphs(g)

  create_edges(sub_graphs)
  g.output(output)
end