Class: ConfigPlus::DefaultLoaderLogic
- Inherits:
-
Object
- Object
- ConfigPlus::DefaultLoaderLogic
- Defined in:
- lib/config_plus/default_loader_logic.rb
Overview
This loader reads configuration from the specified a YAML file with its load_from method. When a directory is specified this recurses a file tree and reads all YAML files.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(extension) ⇒ DefaultLoaderLogic
constructor
A new instance of DefaultLoaderLogic.
- #load_from(path) ⇒ Object
Constructor Details
#initialize(extension) ⇒ DefaultLoaderLogic
Returns a new instance of DefaultLoaderLogic.
10 11 12 |
# File 'lib/config_plus/default_loader_logic.rb', line 10 def initialize(extension) @extension = extension || [:yml, :yaml] end |
Instance Method Details
#load_from(path) ⇒ Object
14 15 16 17 18 |
# File 'lib/config_plus/default_loader_logic.rb', line 14 def load_from(path) raise Errno::ENOENT, "No such file or directory: `#{path}'" unless File.exist?(path) return load_file(path) if File.file?(path) load_dir(path) end |