| Class | Core::Config::XMLParser |
| In: |
core/config.rb
|
| Parent: | Object |
ParserInterface implementation to read configuration parameters from a XML file.
Read and parse the XML file. Stores the options in an internal Hash to speed up the retrieving process.
# File core/config.rb, line 56
56: def initialize(file)
57: src = REXML::Document.new(File.new(file))
58: @options = {}
59: src.elements.each('dradis/option') do |element|
60: @options[element.attributes['name'].to_sym] = element.attributes['value']
61: end
62: end
See ParserInterface#get_option
# File core/config.rb, line 65
65: def get_option(key)
66: if @options.key?(key)
67: @options[key]
68: else
69: raise ArgumentError.new('option not found in config file!')
70: end
71: end