class Calypso::YAMLParser
YAML parser library
Public Class Methods
new(file)
click to toggle source
Create a new YAML parser.
@param file [String] Path to the configuration file.
Calls superclass method
Calypso::IParser::new
# File lib/calypso/yamlparser.rb, line 33 def initialize(file) super end
Public Instance Methods
parse()
click to toggle source
Parse the configuration file.
@return [nil]
# File lib/calypso/yamlparser.rb, line 40 def parse obj = YAML.load_file(@file) hardware = Hash.new tests = Hash.new obj['hardware'].each do |key, value| hw = Calypso::Hardware.new(key, value['name'], value['cpu']) hardware[key] = hw end obj['unit-tests'].each do |key, value| hw = hardware[value['hardware']] port = value['port'] baud = value['baud'] serial = Calypso::SerialPortData.new(port, baud) tst = Calypso::UnitTest.new(value, serial, hw) tests[key] = tst hw.add_test tst end set_hardware(hardware) set_tests(tests) end