Class: ConfigPlus::Loader
- Inherits:
-
Object
- Object
- ConfigPlus::Loader
- Defined in:
- lib/config_plus/loader.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Loader
constructor
A new instance of Loader.
- #load ⇒ Object
Constructor Details
#initialize(config) ⇒ Loader
Returns a new instance of Loader.
3 4 5 |
# File 'lib/config_plus/loader.rb', line 3 def initialize(config) @config = config end |
Instance Method Details
#load ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/config_plus/loader.rb', line 7 def load paths = source_paths raise "No specified `source'" if paths.empty? paths.each.inject({}) do |h, path| hsh = loader_logic.load_from(path) hsh = hsh[@config.namespace.to_s] if @config.namespace Merger.merge(h, hsh) end end |