Class: AppKonfig::Config
- Inherits:
-
Hash
- Object
- Hash
- AppKonfig::Config
- Defined in:
- lib/app_konfig/config.rb
Constant Summary collapse
- DEFAULT_ENV =
'development'
- CONFIG_PATH =
{ public: './config/config.yml', secret: './config/secrets.yml', }
Instance Method Summary collapse
- #get(args) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #method_missing(key) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 18 |
# File 'lib/app_konfig/config.rb', line 15 def initialize super deep_merge!(pub_config).deep_merge!(sec_config) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#get(args) ⇒ Object
20 21 22 23 24 |
# File 'lib/app_konfig/config.rb', line 20 def get(args) args.split('.').inject(self) { |hash, arg| hash.fetch(arg) } rescue KeyError raise AppKonfig::ConfigurationKeyNotFound.new("configuration key not found") end |