Class: Depository::Serialize::Packer
- Inherits:
-
Object
- Object
- Depository::Serialize::Packer
- Defined in:
- lib/depository/serialize.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config, model) ⇒ Packer
constructor
A new instance of Packer.
Constructor Details
#initialize(config, model) ⇒ Packer
Returns a new instance of Packer.
14 15 16 17 |
# File 'lib/depository/serialize.rb', line 14 def initialize(config, model) self.config = config self.model = model end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/depository/serialize.rb', line 19 def call attrs = normalize(model.to_hash) config.packer.call(attrs) (attrs, model) model.set(Serialize.unpack(config, attrs.dup)) attrs end |