class Hash

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

Public Instance Methods

path_lookup(path) click to toggle source
# File lib/appconf.rb, line 18
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