summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-07-11 12:57:34 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-07-11 12:57:34 -0700
commita65cb52db5985e602a46f5375295761b6f04bb68 (patch)
treeaa89a96750b8d4117934a8624c0fc989c5e83215 /lib
parentc43316fd69daa98e8f1b713622428b0f75da5f1f (diff)
downloadmixlib-config-a65cb52db5985e602a46f5375295761b6f04bb68.tar.gz
test+fix config contexts
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/mixlib/config.rb36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/mixlib/config.rb b/lib/mixlib/config.rb
index 3ef06e8..aa56cea 100644
--- a/lib/mixlib/config.rb
+++ b/lib/mixlib/config.rb
@@ -555,6 +555,25 @@ module Mixlib
internal_get_or_set(method_symbol, *args)
end
+ protected
+
+ # Given a (nested) Hash, apply it to the config object and any contexts.
+ #
+ # This is preferable to converting it to the string representation with
+ # the #to_dotted_hash method above.
+ #
+ # === Parameters
+ # hash<Hash>:: The hash to apply to the config oject
+ def apply_nested_hash(hash)
+ hash.each do |k, v|
+ if v.is_a? Hash
+ internal_get(k.to_sym).apply_nested_hash(v)
+ else
+ internal_set(k.to_sym, v)
+ end
+ end
+ end
+
private
# Given a (nested) Hash, turn it into a single top-level hash using dots as
@@ -578,23 +597,6 @@ module Mixlib
end
end
- # Given a (nested) Hash, apply it to the config object and any contexts.
- #
- # This is preferable to converting it to the string representation with
- # the #to_dotted_hash method above.
- #
- # === Parameters
- # hash<Hash>:: The hash to apply to the config oject
- def apply_nested_hash(hash)
- hash.each do |k, v|
- if v.is_a? Hash
- internal_get(k.to_sym).apply_nested_hash(v)
- else
- internal_set(k.to_sym, v)
- end
- end
- end
-
# Internal dispatch setter for config values.
#
# === Parameters