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

Public Instance Methods

<<(thing) click to toggle source
# File lib/puppet/external/dot.rb, line 252
def << (thing)
  @nodes << thing
end
each_node() { |i| ... } click to toggle source
# File lib/puppet/external/dot.rb, line 248
def each_node
  @nodes.each{ |i| yield i }
end
pop() click to toggle source
# File lib/puppet/external/dot.rb, line 260
def pop
  @nodes.pop
end
push(thing) click to toggle source
# File lib/puppet/external/dot.rb, line 256
def push (thing)
  @nodes.push( thing )
end
to_s(t = '') click to toggle source
# File lib/puppet/external/dot.rb, line 264
def to_s (t = '')
  hdr = t + "#{@dot_string} #{@name} {\n"

  options = @options.to_a.collect{ |name, val|
    val && name != 'label' ?
      t + $tab + "#{name} = #{val}" :
      name ? t + $tab + "#{name} = \"#{val}\"" : nil
  }.compact.join( "\n" ) + "\n"

  nodes = @nodes.collect{ |i|
    i.to_s( t + $tab )
  }.join( "\n" ) + "\n"
  hdr + options + nodes + t + "}\n"
end