Method: PDK::Config#get
- Defined in:
- lib/pdk/config.rb
#get(root, *keys) ⇒ PDK::Config::Namespace, ...
Returns a configuration setting by name. This name can either be a String, Array or parameters e.g. These are equivalent
-
PDK.config.get(‘user.a.b.c’)
-
PDK.config.get([‘user’, ‘a’, ‘b’, ‘c’])
-
PDK.config.get(‘user’, ‘a’, ‘b’, ‘c’)
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/pdk/config.rb', line 123 def get(root, *keys) return nil if root.nil? || root.empty? if keys.empty? if root.is_a?(Array) name = root elsif root.is_a?(String) name = split_key_string(root) else return nil end else name = [root].concat(keys) end get_within_scopes(name[1..-1], [name[0]]) end |