Class: Rviz::Edge
Overview
represent a ->
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
Instance Method Summary collapse
-
#initialize(from_node, from_anchor, to_node, to_anchor = nil, attributes = {}) ⇒ Edge
constructor
A new instance of Edge.
- #node_anchor(node, anchor) ⇒ Object
-
#to_s ⇒ Object
output to dot format.
Methods included from Helper
Constructor Details
#initialize(from_node, from_anchor, to_node, to_anchor = nil, attributes = {}) ⇒ Edge
Returns a new instance of Edge.
6 7 8 |
# File 'lib/rviz/edge.rb', line 6 def initialize from_node, from_anchor, to_node, to_anchor = nil, attributes = {} @from, @from_anchor, @to, @to_anchor, @attrs = from_node, from_anchor, to_node, to_anchor, attributes end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
4 5 6 |
# File 'lib/rviz/edge.rb', line 4 def attrs @attrs end |
Instance Method Details
#node_anchor(node, anchor) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rviz/edge.rb', line 10 def node_anchor node, anchor if anchor and anchor.size > 0 quote(node) + ":" + anchor else quote(node) end end |
#to_s ⇒ Object
output to dot format
21 22 23 24 25 26 27 28 |
# File 'lib/rviz/edge.rb', line 21 def to_s from, to = node_anchor(@from, @from_anchor), node_anchor(@to, @to_anchor) if @attrs.keys.size > 0 sprintf "%s -> %s [%s]", from, to, self.attrs_to_s else sprintf "%s -> %s", from, to end end |