class Chef::Node::AttrArray
AttrArray
¶ ↑
AttrArray
is identical to Array, except that it keeps a reference to the “root” (Chef::Node::Attribute) object, and will trigger a cache invalidation on that object when mutated.
Constants
- MUTATOR_METHODS
Public Class Methods
new(data = [])
click to toggle source
Calls superclass method
# File lib/chef/node/attribute_collections.rb, line 52 def initialize(data = []) super(data) map! { |e| convert_value(e) } end
Public Instance Methods
delete(key, &block)
click to toggle source
Calls superclass method
# File lib/chef/node/attribute_collections.rb, line 47 def delete(key, &block) send_reset_cache(__path__, key) super end
dup()
click to toggle source
# File lib/chef/node/attribute_collections.rb, line 64 def dup Array.new(map { |e| safe_dup(e) }) end
safe_dup(e)
click to toggle source
For elements like Fixnums, true, nil…
# File lib/chef/node/attribute_collections.rb, line 58 def safe_dup(e) e.dup rescue TypeError e end
Private Instance Methods
convert_key(key)
click to toggle source
needed for __path__
# File lib/chef/node/attribute_collections.rb, line 86 def convert_key(key) key end
convert_value(value)
click to toggle source
# File lib/chef/node/attribute_collections.rb, line 70 def convert_value(value) case value when VividMash value when AttrArray value when Hash VividMash.new(value, __root__, __node__, __precedence__) when Array AttrArray.new(value, __root__, __node__, __precedence__) else value end end