class SmartQue::Config
Constants
- CONFIGURATION
Configurations allowed configurations
Public Class Methods
new()
click to toggle source
Initialize
# File lib/smart_que/config.rb, line 8 def initialize @config = {} load_configuration_from_yml end
Public Instance Methods
method_missing(name, *args)
click to toggle source
Calls superclass method
# File lib/smart_que/config.rb, line 13 def method_missing(name, *args) setter = false name = name.to_s if name =~ /=$/ name = name.to_s.chop setter = true end super(name, args) unless CONFIGURATION.include?(name) if setter set(name, args.first) else get(name) end end
Private Instance Methods
get(key)
click to toggle source
# File lib/smart_que/config.rb, line 44 def get(key) @config[key] end
load_configuration_from_yml()
click to toggle source
# File lib/smart_que/config.rb, line 34 def load_configuration_from_yml if File.exist? 'config/smart_que.yml' @config = YAML.load(File.read('config/smart_que.yml')) || @config end end
set(key, val)
click to toggle source
# File lib/smart_que/config.rb, line 40 def set(key, val) @config[key] = val end