Class: Glossarist::ConceptStore::ConceptDocumentSerializer
- Inherits:
-
Object
- Object
- Glossarist::ConceptStore::ConceptDocumentSerializer
- Defined in:
- lib/glossarist/concept_store.rb
Overview
Serializes ConceptDocument for storage in lutaml-store. Stores the YAML stream string to preserve the full concept + localizations.
Instance Method Summary collapse
Instance Method Details
#deserialize(data, model_class) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/glossarist/concept_store.rb', line 17 def deserialize(data, model_class) doc = model_class.from_yamls(data["_yamls"]) doc.id = data["_id"] concept = doc.concept concept.uuid = doc.id if doc.id && concept doc.localizations.each { |l10n| concept&.add_localization(l10n) } doc end |
#serialize(concept_document) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/glossarist/concept_store.rb', line 10 def serialize(concept_document) { "_yamls" => concept_document.to_yamls, "_id" => concept_document.id, } end |