class DOT::DOTSubgraph

A subgraph element is the same to graph, but has another header in dot notation.

Public Class Methods

new(params = {}, option_list = GRAPH_OPTS) click to toggle source
Calls superclass method DOT::DOTElement::new
    # File lib/puppet/external/dot.rb
241 def initialize(params = {}, option_list = GRAPH_OPTS)
242   super(params, option_list)
243   @nodes      = params['nodes'] ? params['nodes'] : []
244   @dot_string = 'graph'
245 end

Public Instance Methods

<<(thing) click to toggle source
    # File lib/puppet/external/dot.rb
251 def <<(thing)
252   @nodes << thing
253 end
each_node() { |i| ... } click to toggle source
    # File lib/puppet/external/dot.rb
247 def each_node
248   @nodes.each{ |i| yield i }
249 end
pop() click to toggle source
    # File lib/puppet/external/dot.rb
259 def pop
260   @nodes.pop
261 end
push(thing) click to toggle source
    # File lib/puppet/external/dot.rb
255 def push(thing)
256   @nodes.push( thing )
257 end
to_s(t = '') click to toggle source
    # File lib/puppet/external/dot.rb
263 def to_s(t = '')
264   hdr = t + "#{@dot_string} #{@name} {\n"
265 
266   options = @options.to_a.collect{ |name, val|
267     val && name != 'label' ?
268       t + $tab + "#{name} = #{val}" :
269       name ? t + $tab + "#{name} = \"#{val}\"" : nil
270   }.compact.join( "\n" ) + "\n"
271 
272   nodes = @nodes.collect{ |i|
273     i.to_s( t + $tab )
274   }.join( "\n" ) + "\n"
275   hdr + options + nodes + t + "}\n"
276 end