Class: Lutaml::Store::FormatSerializer
- Inherits:
-
Object
- Object
- Lutaml::Store::FormatSerializer
- Defined in:
- lib/lutaml/store/format_serializer.rb
Overview
Bridges a Format handler to the ModelSerializer interface. Enables DatabaseStore to use any format (yaml, json, xml, yamls, marshal) for key-value storage instead of the default hash serialization.
Usage:
serializer = FormatSerializer.new(:yamls)
store = DatabaseStore.new(
adapter: :sqlite,
models: [{ model: ConceptDocument, key: :id, serializer: serializer }]
)
Constant Summary collapse
- DATA_KEY =
"_data"- CLASS_KEY =
"_class"
Instance Method Summary collapse
- #deserialize(data, model_class) ⇒ Object
-
#initialize(format) ⇒ FormatSerializer
constructor
A new instance of FormatSerializer.
- #serialize(model) ⇒ Object
Constructor Details
#initialize(format) ⇒ FormatSerializer
Returns a new instance of FormatSerializer.
19 20 21 |
# File 'lib/lutaml/store/format_serializer.rb', line 19 def initialize(format) @format = Format.resolve(format) end |