class UR::XMLConfigFile

Public Class Methods

new(filename) click to toggle source
# File lib/conf.rb, line 6
def initialize(filename)
  @names = {}
  @types = {}
  doc = XML::Smart.open(filename)
  doc.find('/rtde_config/recipe/@key').each do |key|
    @names[key.value] = doc.find("/rtde_config/recipe[@key='#{key}']/field/@name").map {|x| x.to_s }
    @types[key.value] = doc.find("/rtde_config/recipe[@key='#{key}']/field/@type").map {|x| x.to_s }
  end
end

Public Instance Methods

get_recipe(key) click to toggle source
# File lib/conf.rb, line 16
def get_recipe(key)
  return @names[key], @types[key] if @types.include?(key) && @names.include?(key)
end