Module: CROWBOT::Settings
Instance Attribute Summary collapse
-
#_settings ⇒ Object
readonly
Returns the value of attribute _settings.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
35 36 37 |
# File 'lib/crowbot/settings.rb', line 35 def method_missing(name, *args, &block) @settings[name.to_sym] || fail(NoMethodError, "unknown configuration root #{name}", caller) end |
Instance Attribute Details
#_settings ⇒ Object (readonly)
Returns the value of attribute _settings.
27 28 29 |
# File 'lib/crowbot/settings.rb', line 27 def _settings @_settings end |
Instance Method Details
#load!(filename, options = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/crowbot/settings.rb', line 29 def load!(filename, = {}) loaded_settings = YAML.load_file(filename) @settings = loaded_settings.each_with_object({}) { |(key, value), h| h[key.to_sym] = value } @settings.merge! end |