Class: EasyConf::AppConfig
- Inherits:
-
Object
- Object
- EasyConf::AppConfig
- Defined in:
- lib/easy_conf/app_config.rb
Overview
:nodoc
Constant Summary collapse
- MESSAGES =
{ unpermitted_key: 'Found unpermitted key'.freeze, file_not_found: 'Configuration file not found'.freeze, config_not_found: 'Configuration not found'.freeze, }
- EXCEPTIONS =
{ unpermitted_key: 'UnpermittedConfigError'.freeze, file_not_found: 'ConfigFileNotFoundError'.freeze, config_not_found: 'ConfigNotFoundError'.freeze, }
Instance Method Summary collapse
- #__keys ⇒ Object
- #__to_hash ⇒ Object
-
#initialize ⇒ AppConfig
constructor
A new instance of AppConfig.
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize ⇒ AppConfig
Returns a new instance of AppConfig.
16 17 18 |
# File 'lib/easy_conf/app_config.rb', line 16 def initialize @table = __read_config end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
20 21 22 23 24 |
# File 'lib/easy_conf/app_config.rb', line 20 def method_missing(meth, *args, &block) return __notify(:unpermitted_key, meth) if __list_check(meth) __read_from_table(meth) || __read_from_env(meth) || __notify(:config_not_found, meth) end |
Instance Method Details
#__keys ⇒ Object
26 27 28 |
# File 'lib/easy_conf/app_config.rb', line 26 def __keys @table.keys end |
#__to_hash ⇒ Object
30 31 32 |
# File 'lib/easy_conf/app_config.rb', line 30 def __to_hash @table.dup end |