Module: Serega::SeregaPlugins::Root::DataBuilderClassMethods
- Defined in:
- lib/serega/plugins/root/root.rb
Overview
SeregaDataBuilder additional/patched class methods
Overrides call to handle the root key: the serialized result is
unwrapped from the root key, converted to a Data tree by the base
implementation, and then re-wrapped together with any metadata keys
in an outer Data object. Metadata values (arbitrary hashes/arrays)
are recursively converted to Data objects via deep_hash_to_data.
When the root key is nil (disabled), delegates directly to the base.
Instance Method Summary collapse
-
#call(serializer, serialized_result, serialization_opts) ⇒ Data, ...
Serialization result as Data object(s).
Instance Method Details
#call(serializer, serialized_result, serialization_opts) ⇒ Data, ...
Returns Serialization result as Data object(s).
272 273 274 275 276 277 278 |
# File 'lib/serega/plugins/root/root.rb', line 272 def call(serializer, serialized_result, serialization_opts) root_key = resolve_root_key(serializer, serialization_opts) return super(serializer, serialized_result) unless root_key root_data = super(serializer, serialized_result.fetch(root_key)) build_data_objects(serialized_result, root_key, root_data) end |