module Chef::Node::Immutablize
Public Instance Methods
convert_value(value)
click to toggle source
# File lib/chef/node/immutable_collections.rb, line 33 def convert_value(value) case value when Hash ImmutableMash.new(value, __root__, __node__, __precedence__) when Array ImmutableArray.new(value, __root__, __node__, __precedence__) when ImmutableMash, ImmutableArray value else safe_dup(value).freeze end end
immutablize(value)
click to toggle source
# File lib/chef/node/immutable_collections.rb, line 46 def immutablize(value) convert_value(value) end
safe_dup(e)
click to toggle source
For elements like Fixnums, true, nil…
# File lib/chef/node/immutable_collections.rb, line 27 def safe_dup(e) e.dup rescue TypeError e end