Class: Hanuman::Graphvizzer::Universe

Inherits:
Graph
  • Object
show all
Defined in:
lib/hanuman/graphvizzer/gv_models.rb

Instance Method Summary collapse

Methods inherited from Graph

#edge, #graph, #node

Methods inherited from Item

#attrib, #brace, #close_brace, #indent, #line, #quote

Instance Method Details

#depthObject



97
# File 'lib/hanuman/graphvizzer/gv_models.rb', line 97

def depth() 0; end

#save(path, type = nil) ⇒ Object



99
100
101
102
103
104
# File 'lib/hanuman/graphvizzer/gv_models.rb', line 99

def save(path, type=nil)
  File.open "#{path}.dot", "w" do |f|
    f.puts self.to_s
  end
  system "#{engine} -T#{type} #{path}.dot > #{path}.#{type}" if type
end

#to_sObject



86
87
88
89
90
91
92
93
94
95
# File 'lib/hanuman/graphvizzer/gv_models.rb', line 86

def to_s
  str = []
  str << brace("digraph #{name}")         ## digraph Wukong {
  str << line("  rankdir = #{orient}")    ##   rankdir = TB;
  items.each do |item|                    ##   subgraph "cluster_cherry_pie" {
    str << item.to_s                      ##     # ...
  end                                     ##   }
  str << close_brace                      ## }
  str.join("\n")
end