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
242 def initialize(params = {}, option_list = GRAPH_OPTS)
243   super(params, option_list)
244   @nodes      = params['nodes'] ? params['nodes'] : []
245   @dot_string = 'graph'
246 end

Public Instance Methods

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