Class | DOT::DOTSubgraph |
In: |
dot/dot.rb
|
Parent: | DOTElement |
subgraph element is the same to graph, but has another header in dot notation
# File dot/dot.rb, line 188 188: def initialize( params = {}, option_list = GRAPH_OPTS ) 189: super( params, option_list ) 190: @nodes = params['nodes'] ? params['nodes'] : [] 191: @dot_string = 'subgraph' 192: end
# File dot/dot.rb, line 210 210: def to_s( t = '' ) 211: hdr = t + "#{@dot_string} #{@name} {\n" 212: 213: options = @options.to_a.collect{ |name, val| 214: val && name != 'label' ? 215: t + $tab + "#{name} = #{val}" : 216: name ? t + $tab + "#{name} = \"#{val}\"" : nil 217: }.compact.join( "\n" ) + "\n" 218: 219: nodes = @nodes.collect{ |i| 220: i.to_s( t + $tab ) 221: }.join( "\n" ) + "\n" 222: hdr + options + nodes + t + "}\n" 223: end