Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/appconf.rb
Overview
usage: AppConfig.setup(‘myApp’, ‘app/root/dir’, ‘deploy/config/dir’) #‘app_root_dir’ determines where distribute-default config resides #‘myApp’ will be converted to lowercase automatically. #‘deploy_config_dir’: config file residential dir on deployment, can be nil, # in which case, config dir from environment MYAPP_CONFIG_DIR will be used. config = AppConfig::get_config(‘config_name’, ‘config/dir’) #‘config_name’ can be nil, in which case myapp.config.yaml is used. #‘config/dir’ non-nil to override deploy config dir from AppConfig::setup to query config item: config
Instance Method Summary collapse
Instance Method Details
#path_lookup(path) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/appconf.rb', line 19 def path_lookup(path) return nil if path == nil || path.to_s.empty? path = path.to_s path_list = path.split('.') o = self path_list.each_with_index do |pe, idx| o = o[pe] || o[pe.to_sym] return nil if o == nil || !o.is_a?(Hash) && idx < path_list.length - 1 end o end |