Method: Chef::DataBagItem.from_hash

Defined in:
lib/chef/data_bag_item.rb

.from_hash(h) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/chef/data_bag_item.rb', line 135

def self.from_hash(h)
  h.delete("chef_type")
  h.delete("json_class")

  item = new
  item.data_bag(h.delete("data_bag")) if h.key?("data_bag")
  if h.key?("raw_data")
    item.raw_data = h["raw_data"]
  else
    item.raw_data = h
  end
  item
end