Method: ChefAPI::Resource::DataBagItem#to_hash

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

#to_hashObject

Override the to_hash method to move data to the upper scope.

See Also:

  • ChefAPI::Resource::DataBagItem.(Resource(Resource::Base(Resource::Base#to_hash)


41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chef-api/resources/data_bag_item.rb', line 41

def to_hash
  {}.tap do |hash|
    _attributes.each do |key, value|
      if key == :data
        hash.merge!(value)
      else
        hash[key] = value.respond_to?(:to_hash) ? value.to_hash : value
      end
    end
  end
end