Class: Orocos::ROS::NameMappings
- Inherits:
-
Object
- Object
- Orocos::ROS::NameMappings
- Defined in:
- lib/orocos/ros/name_mappings.rb
Overview
Implementation of the ROS name mappings rules
Instance Attribute Summary collapse
-
#mappings ⇒ Object
readonly
Returns the value of attribute mappings.
Instance Method Summary collapse
- #apply(string) ⇒ Object
-
#initialize(mappings = Hash.new) ⇒ NameMappings
constructor
A new instance of NameMappings.
- #to_command_line ⇒ Object
Constructor Details
#initialize(mappings = Hash.new) ⇒ NameMappings
Returns a new instance of NameMappings
7 8 9 |
# File 'lib/orocos/ros/name_mappings.rb', line 7 def initialize(mappings = Hash.new) @mappings = mappings end |
Instance Attribute Details
#mappings ⇒ Object (readonly)
Returns the value of attribute mappings
5 6 7 |
# File 'lib/orocos/ros/name_mappings.rb', line 5 def mappings @mappings end |
Instance Method Details
#apply(string) ⇒ Object
11 12 13 |
# File 'lib/orocos/ros/name_mappings.rb', line 11 def apply(string) mappings[string] || string end |
#to_command_line ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/orocos/ros/name_mappings.rb', line 15 def to_command_line result = [] mappings.each do |from, to| if from =~ /^~/ from = "_#{from[1..-1]}" end result << "#{from}:=#{to}" end result.join(" ") end |