Class: Pantry::DryGood

Inherits:
OpenStruct
  • Object
show all
Includes:
ActiveModel::Serialization
Defined in:
lib/pantry/dry_good.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



10
11
12
# File 'lib/pantry/dry_good.rb', line 10

def ==(other)
  super
end

#as_json(options = nil) ⇒ Object

OpenStruct objects don’t turn into hashes wrapped in a ‘table’ key goo.gl/vPjtgz



20
21
22
# File 'lib/pantry/dry_good.rb', line 20

def as_json(options = nil)
  @table.as_json(options)
end

#attributesObject

Implements required interface method for ActiveModel::Serialization.



6
7
8
# File 'lib/pantry/dry_good.rb', line 6

def attributes
  to_h.deep_stringify_keys
end

#hashObject



14
15
16
# File 'lib/pantry/dry_good.rb', line 14

def hash
  super
end