Class: VisualizeRuby::Graphviz
- Inherits:
-
Object
- Object
- VisualizeRuby::Graphviz
- Defined in:
- lib/visualize_ruby/graphviz.rb
Instance Attribute Summary collapse
-
#graphs ⇒ Object
readonly
Returns the value of attribute graphs.
-
#only_graphs ⇒ Object
readonly
Returns the value of attribute only_graphs.
-
#unique_nodes ⇒ Object
readonly
Returns the value of attribute unique_nodes.
Instance Method Summary collapse
-
#initialize(builder_result = nil, graphs: nil, label: nil, unique_nodes: true, only_graphs: nil) ⇒ Graphviz
constructor
A new instance of Graphviz.
- #to_graph(format: nil, path: nil) ⇒ Object
Constructor Details
#initialize(builder_result = nil, graphs: nil, label: nil, unique_nodes: true, only_graphs: nil) ⇒ Graphviz
Returns a new instance of Graphviz.
7 8 9 10 11 12 |
# File 'lib/visualize_ruby/graphviz.rb', line 7 def initialize(builder_result = nil, graphs: nil, label: nil, unique_nodes: true, only_graphs: nil) @graphs = graphs || builder_result.graphs @label = builder_result ? builder_result.[:label] : label @unique_nodes = unique_nodes @only_graphs = [*only_graphs] end |
Instance Attribute Details
#graphs ⇒ Object (readonly)
Returns the value of attribute graphs.
5 6 7 |
# File 'lib/visualize_ruby/graphviz.rb', line 5 def graphs @graphs end |
#only_graphs ⇒ Object (readonly)
Returns the value of attribute only_graphs.
5 6 7 |
# File 'lib/visualize_ruby/graphviz.rb', line 5 def only_graphs @only_graphs end |
#unique_nodes ⇒ Object (readonly)
Returns the value of attribute unique_nodes.
5 6 7 |
# File 'lib/visualize_ruby/graphviz.rb', line 5 def unique_nodes @unique_nodes end |
Instance Method Details
#to_graph(format: nil, path: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/visualize_ruby/graphviz.rb', line 14 def to_graph(format: nil, path: nil) build if format == String str = StringIO.new main_graph.dump_graph(str) str.string else ::Graphviz.output(main_graph, path: path, format: format) end end |