Class: Docman::Config
- Inherits:
-
Hash
- Object
- Hash
- Docman::Config
- Defined in:
- lib/docman/config.rb
Instance Method Summary collapse
- #assign_to_self ⇒ Object
- #config_hash ⇒ Object
-
#initialize(file) ⇒ Config
constructor
A new instance of Config.
- #merge_config_from_file(file) ⇒ Object
Constructor Details
#initialize(file) ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 |
# File 'lib/docman/config.rb', line 8 def initialize(file) super @config = YAML::load_file(file) assign_to_self end |
Instance Method Details
#assign_to_self ⇒ Object
14 15 16 17 18 |
# File 'lib/docman/config.rb', line 14 def assign_to_self @config.each_pair do |k, v| self[k] = v end end |
#config_hash ⇒ Object
26 27 28 |
# File 'lib/docman/config.rb', line 26 def config_hash Digest::MD5.hexdigest(Marshal::dump(self)) end |
#merge_config_from_file(file) ⇒ Object
20 21 22 23 24 |
# File 'lib/docman/config.rb', line 20 def merge_config_from_file(file) config = YAML::load_file(file) @config.deep_merge(config) assign_to_self end |