Class: RGL::DOT::Port
- Inherits:
-
Object
- Object
- RGL::DOT::Port
- Defined in:
- lib/laser/third_party/rgl/rdot.rb
Overview
Ports are used when a Node instance has its `shape' option set to record or Mrecord. Ports can be nested.
Instance Attribute Summary (collapse)
-
- (Object) label
Returns the value of attribute label.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) ports
Returns the value of attribute ports.
Instance Method Summary (collapse)
-
- (Port) initialize(name_or_ports = nil, label = nil)
constructor
Create a new port with either an optional name and label or a set of nested ports.
-
- (Object) to_s
Returns a string representation of this port.
Constructor Details
- (Port) initialize(name_or_ports = nil, label = nil)
Create a new port with either an optional name and label or a set of nested ports.
:call-seq:
new(name = nil, label = nil)
new(ports)
A nil value for name is valid; otherwise, it must be a String or it will be interpreted as ports.
198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/laser/third_party/rgl/rdot.rb', line 198 def initialize (name_or_ports = nil, label = nil) if name_or_ports.nil? or name_or_ports.kind_of?(String) then @name = name_or_ports @label = label @ports = nil else @ports = name_or_ports @name = nil @label = nil end end |
Instance Attribute Details
- (Object) label
Returns the value of attribute label
187 188 189 |
# File 'lib/laser/third_party/rgl/rdot.rb', line 187 def label @label end |
- (Object) name
Returns the value of attribute name
187 188 189 |
# File 'lib/laser/third_party/rgl/rdot.rb', line 187 def name @name end |
- (Object) ports
Returns the value of attribute ports
187 188 189 |
# File 'lib/laser/third_party/rgl/rdot.rb', line 187 def ports @ports end |
Instance Method Details
- (Object) to_s
Returns a string representation of this port. If ports is a non-empty Enumerable, a nested ports representation is returned; otherwise, a name-label representation is returned.
213 214 215 216 217 218 219 220 |
# File 'lib/laser/third_party/rgl/rdot.rb', line 213 def to_s if @ports.nil? or @ports.empty? then n = (name.nil? or name.empty?) ? '' : "<#{name}>" n + ((n.empty? or label.nil? or label.empty?) ? '' : ' ') + label.to_s else '{' + @ports.collect {|p| p.to_s}.join(' | ') + '}' end end |