Module: Confie
Constant Summary collapse
- @@_files =
[]
Instance Method Summary collapse
- #extend!(mod, name = 'settings') ⇒ Object
- #files ⇒ Object
- #files=(files) ⇒ Object
- #load(files) ⇒ Object
- #load! ⇒ Object
Instance Method Details
#extend!(mod, name = 'settings') ⇒ Object
20 21 22 |
# File 'lib/confie.rb', line 20 def extend!(mod, name = 'settings') mod.extend load!.to_module(name) end |
#files ⇒ Object
8 9 10 |
# File 'lib/confie.rb', line 8 def files @@_files end |
#files=(files) ⇒ Object
12 13 14 |
# File 'lib/confie.rb', line 12 def files=(files) @@_files = files end |
#load(files) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/confie.rb', line 24 def load(files) content = Hashie::Mash.new Array(files).flatten.compact.uniq.each do |f| next unless File.exists?(f) content.deep_merge! Hashie::Mash.load(f) end content end |
#load! ⇒ Object
16 17 18 |
# File 'lib/confie.rb', line 16 def load! load files end |