class Parser::Config
Constants
- DEFAULTS
- OPTIONS
Public Class Methods
new()
click to toggle source
# File lib/parser/config.rb, line 20 def initialize reset! end
Public Instance Methods
load!(file)
click to toggle source
# File lib/parser/config.rb, line 24 def load!(file) config = config_from_file(file) OPTIONS.each do |key| set_option(key, config[key]) if config.include?(key) end end
reset!()
click to toggle source
# File lib/parser/config.rb, line 32 def reset! OPTIONS.each do |key| set_option(key, DEFAULTS[key]) end end
Private Instance Methods
config_from_file(file)
click to toggle source
# File lib/parser/config.rb, line 40 def config_from_file(file) @config_from_file ||= YAML.load(File.read(file)).symbolize_keys end
set_option(key, value)
click to toggle source
# File lib/parser/config.rb, line 44 def set_option(key, value) self.send("#{key}=", value) end