Class: Glossarist::ManagedConceptData
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Glossarist::ManagedConceptData
show all
- Includes:
- Utilities::CommonFunctions
- Defined in:
- lib/glossarist/managed_concept_data.rb
Instance Method Summary
collapse
-
#domains_from_yaml(model, value) ⇒ Object
-
#domains_to_yaml(model, doc) ⇒ Object
-
#figures_from_yaml(model, value) ⇒ Object
-
#figures_to_yaml(model, doc) ⇒ Object
-
#formulas_from_yaml(model, value) ⇒ Object
-
#formulas_to_yaml(model, doc) ⇒ Object
-
#id_from_yaml(model, value) ⇒ Object
-
#id_to_yaml(model, doc) ⇒ Object
-
#localizations_from_yaml(model, value) ⇒ Object
-
#localizations_to_yaml(model, doc) ⇒ Object
-
#tables_from_yaml(model, value) ⇒ Object
-
#tables_to_yaml(model, doc) ⇒ Object
#convert_keys_to_snake_case, #slice_keys, #snake_case, #stringify_keys, #symbolize_keys
Instance Method Details
#domains_from_yaml(model, value) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/glossarist/managed_concept_data.rb', line 57
def domains_from_yaml(model, value)
return unless value.is_a?(Array)
model.domains = value.map do |item|
if item.is_a?(Hash)
ConceptReference.of_yaml(item)
else
ConceptReference.new(concept_id: item.to_s, ref_type: "domain")
end
end
end
|
#domains_to_yaml(model, doc) ⇒ Object
69
70
71
72
73
|
# File 'lib/glossarist/managed_concept_data.rb', line 69
def domains_to_yaml(model, doc)
return if model.domains.nil? || model.domains.empty?
doc["domains"] = model.domains.map(&:to_hash)
end
|
75
76
77
|
# File 'lib/glossarist/managed_concept_data.rb', line 75
def figures_from_yaml(model, value)
model.figures = parse_non_verbal_refs(value, FigureReference)
end
|
79
80
81
|
# File 'lib/glossarist/managed_concept_data.rb', line 79
def figures_to_yaml(model, doc)
serialize_non_verbal_refs(model.figures, doc, "figures")
end
|
91
92
93
|
# File 'lib/glossarist/managed_concept_data.rb', line 91
def formulas_from_yaml(model, value)
model.formulas = parse_non_verbal_refs(value, FormulaReference)
end
|
95
96
97
|
# File 'lib/glossarist/managed_concept_data.rb', line 95
def formulas_to_yaml(model, doc)
serialize_non_verbal_refs(model.formulas, doc, "formulas")
end
|
#id_from_yaml(model, value) ⇒ Object
43
44
45
|
# File 'lib/glossarist/managed_concept_data.rb', line 43
def id_from_yaml(model, value)
model.id = value unless model.id
end
|
#id_to_yaml(model, doc) ⇒ Object
38
39
40
41
|
# File 'lib/glossarist/managed_concept_data.rb', line 38
def id_to_yaml(model, doc)
value = model.id
doc["identifier"] = value if value && !doc["identifier"]
end
|
#localizations_from_yaml(model, value) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/glossarist/managed_concept_data.rb', line 47
def localizations_from_yaml(model, value)
value.each do |localized_concept_hash|
localized_concept = Glossarist::LocalizedConcept.of_yaml(localized_concept_hash)
model.localizations.store(localized_concept.language_code,
localized_concept)
end
end
|
#localizations_to_yaml(model, doc) ⇒ Object
55
|
# File 'lib/glossarist/managed_concept_data.rb', line 55
def localizations_to_yaml(model, doc); end
|
#tables_from_yaml(model, value) ⇒ Object
83
84
85
|
# File 'lib/glossarist/managed_concept_data.rb', line 83
def tables_from_yaml(model, value)
model.tables = parse_non_verbal_refs(value, TableReference)
end
|
#tables_to_yaml(model, doc) ⇒ Object
87
88
89
|
# File 'lib/glossarist/managed_concept_data.rb', line 87
def tables_to_yaml(model, doc)
serialize_non_verbal_refs(model.tables, doc, "tables")
end
|