summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/node/attribute_collections.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb
index b36d4a1540..1bd31bceb0 100644
--- a/lib/chef/node/attribute_collections.rb
+++ b/lib/chef/node/attribute_collections.rb
@@ -73,6 +73,7 @@ class Chef
def initialize(root, data)
@root = root
super(data)
+ map! { |e| convert_value(e) }
end
# For elements like Fixnums, true, nil...
@@ -86,6 +87,23 @@ class Chef
Array.new(map { |e| safe_dup(e) })
end
+ private
+
+ def convert_value(value)
+ case value
+ when VividMash
+ value
+ when AttrArray
+ value
+ when Hash
+ VividMash.new(root, value)
+ when Array
+ AttrArray.new(root, value)
+ else
+ value
+ end
+ end
+
end
# == VividMash
@@ -184,10 +202,12 @@ class Chef
case value
when VividMash
value
+ when AttrArray
+ value
when Hash
VividMash.new(root, value)
when Array
- AttrArray.new(root, value.map { |e| convert_value(e) })
+ AttrArray.new(root, value)
else
value
end