Class: Glossarist::V1::CrossReferences
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Glossarist::V1::CrossReferences
- Defined in:
- lib/glossarist/v1/cross_references.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_file(path) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/glossarist/v1/cross_references.rb', line 13 def self.from_file(path) return nil unless path && File.exist?(path) from_yaml(File.read(path)) rescue Psych::SyntaxError, Lutaml::Model::InvalidFormatError nil end |
Instance Method Details
#to_ref_maps ⇒ Object
33 34 35 36 37 38 |
# File 'lib/glossarist/v1/cross_references.rb', line 33 def to_ref_maps { ref_prefix_map: ref_prefix_map, urn_standard_map: urn_standard_map, } end |
#xref_from_yaml(model, value) ⇒ Object
21 22 23 24 |
# File 'lib/glossarist/v1/cross_references.rb', line 21 def xref_from_yaml(model, value) model.ref_prefix_map = value&.dig("refPrefixMap") || {} model.urn_standard_map = value&.dig("urnStandardMap") || {} end |
#xref_to_yaml(model, doc) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/glossarist/v1/cross_references.rb', line 26 def xref_to_yaml(model, doc) doc["crossReferences"] = { "refPrefixMap" => model.ref_prefix_map, "urnStandardMap" => model.urn_standard_map, } end |