Module: Knuckles::Stages::Dumper
Overview
The dumping process combines de-duplication and actual serialization. For every top level key that is an array all of the children will have uniqueness enforced. For example, if you had rendered a collection of posts that shared the same author, you will only have a single author object serialized. Be aware that the uniqueness check relies on the presence of an ‘id` key rather than full object comparisons.
Instance Method Summary collapse
-
#call(objects, _options) ⇒ Object
De-duplicate values in all keys and merge them into a single hash.
Instance Method Details
#call(objects, _options) ⇒ Object
De-duplicate values in all keys and merge them into a single hash. Afterwards the complete hash is serialized using the serializer configured at ‘Knuckles.serializer`.
22 23 24 |
# File 'lib/knuckles/stages/dumper.rb', line 22 def call(objects, ) Knuckles.serializer.dump(keys_to_arrays(objects)) end |