Class: Chef::Node::AttrArray
- Inherits:
-
Array
- Object
- Array
- Chef::Node::AttrArray
- Defined in:
- lib/chef/node/attribute_collections.rb
Overview
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.
Constant Summary collapse
- MUTATOR_METHODS =
[ :<<, :[]=, :clear, :collect!, :compact!, :default=, :default_proc=, :delete, :delete_at, :delete_if, :fill, :flatten!, :insert, :keep_if, :map!, :merge!, :pop, :push, :update, :reject!, :reverse!, :replace, :select!, :shift, :slice!, :sort!, :sort_by!, :uniq!, :unshift, ]
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #dup ⇒ Object
-
#initialize(root, data) ⇒ AttrArray
constructor
A new instance of AttrArray.
-
#safe_dup(e) ⇒ Object
For elements like Fixnums, true, nil…
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
71 72 73 |
# File 'lib/chef/node/attribute_collections.rb', line 71 def root @root end |
Instance Method Details
#dup ⇒ Object
85 86 87 |
# File 'lib/chef/node/attribute_collections.rb', line 85 def dup Array.new(map { |e| safe_dup(e) }) end |
#safe_dup(e) ⇒ Object
For elements like Fixnums, true, nil…
79 80 81 82 83 |
# File 'lib/chef/node/attribute_collections.rb', line 79 def safe_dup(e) e.dup rescue TypeError e end |