Class: Rviz::Node

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/rviz/node.rb

Direct Known Subclasses

Record

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#attrs_to_s, #quote, #set

Constructor Details

#initialize(name, shape = "box", attrs = {}) ⇒ Node

Returns a new instance of Node.



4
5
6
7
# File 'lib/rviz/node.rb', line 4

def initialize name, shape = "box", attrs = {}
  @name = name
  @attrs = {"shape" => shape}.merge attrs
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/rviz/node.rb', line 3

def name
  @name
end

Instance Method Details

#shapeObject



9
10
11
# File 'lib/rviz/node.rb', line 9

def shape
  @attrs["shape"]
end

#to_sObject

print out as dot source



16
17
18
# File 'lib/rviz/node.rb', line 16

def to_s
  sprintf '%s [%s]', self.quote(@name), self.attrs_to_s
end