Class DOT::DOTNode
In: lib/puppet/external/dot.rb
Parent: DOTElement

node element

Methods

<<   each_port   new   pop   push   to_s  

Public Class methods

[Source]

     # File lib/puppet/external/dot.rb, line 187
187:     def initialize (params = {}, option_list = NODE_OPTS)
188:       super(params, option_list)
189:       @ports = params['ports'] ? params['ports'] : []
190:     end

Public Instance methods

[Source]

     # File lib/puppet/external/dot.rb, line 196
196:     def << (thing)
197:       @ports << thing
198:     end

[Source]

     # File lib/puppet/external/dot.rb, line 192
192:     def each_port
193:       @ports.each { |i| yield i }
194:     end

[Source]

     # File lib/puppet/external/dot.rb, line 204
204:     def pop
205:       @ports.pop
206:     end

[Source]

     # File lib/puppet/external/dot.rb, line 200
200:     def push (thing)
201:       @ports.push(thing)
202:     end

[Source]

     # File lib/puppet/external/dot.rb, line 208
208:     def to_s (t = '')
209: 
210:       # This code is totally incomprehensible; it needs to be replaced!
211: 
212:       label = @options['shape'] != 'record' && @ports.length == 0 ?
213:                 @options['label'] ? 
214:                     t + $tab + "label = \"#{@options['label']}\"\n" :
215:                     '' :
216:                 t + $tab + 'label = "' + " \\\n" +
217:                 t + $tab2 + "#{@options['label']}| \\\n" +
218:                 @ports.collect{ |i|
219:                     t + $tab2 + i.to_s
220:                 }.join( "| \\\n" ) + " \\\n" +
221:                 t + $tab + '"' + "\n"
222:             
223:             t + "#{@name} [\n" +
224:             @options.to_a.collect{ |i|
225:                 i[1] && i[0] != 'label' ? 
226:                     t + $tab + "#{i[0]} = #{i[1]}" : nil
227:             }.compact.join( ",\n" ) + ( label != '' ? ",\n" : "\n" ) + 
228:             label +
229:             t + "]\n" 
230:       end

[Validate]