Class: Chef::Node::AttrArray

Inherits:
Array
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(root, data) ⇒ AttrArray

Returns a new instance of AttrArray.



74
75
76
77
# File 'lib/chef/node/attribute_collections.rb', line 74

def initialize(root, data)
  @root = root
  super(data)
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



72
73
74
# File 'lib/chef/node/attribute_collections.rb', line 72

def root
  @root
end

Instance Method Details

#dupObject



79
80
81
# File 'lib/chef/node/attribute_collections.rb', line 79

def dup
  Array.new(map {|e| e.dup})
end