Class DOT::DOTNode
In: dot/dot.rb
Parent: DOTElement

node element

Methods

<<   each_port   new   pop   push   to_s  

Public Class methods

[Source]

     # File dot/dot.rb, line 140
140:         def initialize( params = {}, option_list = NODE_OPTS )
141:             super( params, option_list )
142:             @ports = params['ports'] ? params['ports'] : []
143:         end

Public Instance methods

[Source]

     # File dot/dot.rb, line 149
149:         def << ( thing )
150:             @ports << thing
151:         end

[Source]

     # File dot/dot.rb, line 145
145:         def each_port
146:             @ports.each{ |i| yield i }
147:         end

[Source]

     # File dot/dot.rb, line 157
157:         def pop
158:             @ports.pop
159:         end

[Source]

     # File dot/dot.rb, line 153
153:         def push ( thing )
154:             @ports.push( thing )
155:         end

[Source]

     # File dot/dot.rb, line 161
161:         def to_s( t = '' )
162: 
163:             label = @options['shape'] != 'record' && @ports.length == 0 ?
164:                 @options['label'] ?
165:                     t + $tab + "label = \"#{@options['label']}\"\n" :
166:                     '' :
167:                 t + $tab + 'label = "' + " \\\n" +
168:                 t + $tab2 + "#{@options['label']}| \\\n" +
169:                 @ports.collect{ |i|
170:                     t + $tab2 + i.to_s
171:                 }.join( "| \\\n" ) + " \\\n" +
172:                 t + $tab + '"' + "\n"
173: 
174:             t + "#{@name} [\n" +
175:             @options.to_a.collect{ |i|
176:                 i[1] && i[0] != 'label' ?
177:                     t + $tab + "#{i[0]} = #{i[1]}" : nil
178:             }.compact.join( ",\n" ) + ( label != '' ? ",\n" : "\n" ) +
179:             label +
180:             t + "]\n"
181:         end

[Validate]