Method: ChefAPI::Resource::DataBagItem#initialize

Defined in:
lib/chef-api/resources/data_bag_item.rb

#initialize(attributes = {}, prefix = {}, bag = nil) ⇒ DataBagItem

Override the initialize method to move any attributes into the data hash.



28
29
30
31
32
33
# File 'lib/chef-api/resources/data_bag_item.rb', line 28

def initialize(attributes = {}, prefix = {}, bag = nil)
  @bag = bag || Resource::DataBag.fetch(prefix[:bag])

  id = attributes.delete(:id) || attributes.delete('id')
  super({ id: id, data: attributes }, prefix)
end