Class: Glossarist::ConceptData
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Glossarist::ConceptData
show all
- Includes:
- Utilities::CommonFunctions
- Defined in:
- lib/glossarist/concept_data.rb
Instance Method Summary
collapse
#convert_keys_to_snake_case, #slice_keys, #snake_case, #stringify_keys, #symbolize_keys
Instance Method Details
#all_sources ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/glossarist/concept_data.rb', line 82
def all_sources
list = sources.to_a
definition.each { |d| list.concat(d.sources.to_a) }
notes.each { |n| list.concat(n.sources.to_a) }
examples.each { |e| list.concat(e.sources.to_a) }
list
end
|
#authoritative_source ⇒ Object
76
77
78
79
80
|
# File 'lib/glossarist/concept_data.rb', line 76
def authoritative_source
return [] unless sources
sources.select(&:authoritative?)
end
|
#date_accepted ⇒ Object
70
71
72
73
74
|
# File 'lib/glossarist/concept_data.rb', line 70
def date_accepted
return nil unless dates
dates.find(&:accepted?)
end
|
#terms_from_yaml(model, value) ⇒ Object
62
63
64
|
# File 'lib/glossarist/concept_data.rb', line 62
def terms_from_yaml(model, value)
model.terms = value.map { |v| Designation::Base.of_yaml(v) }
end
|
#terms_to_yaml(model, doc) ⇒ Object
66
67
68
|
# File 'lib/glossarist/concept_data.rb', line 66
def terms_to_yaml(model, doc)
doc["terms"] = model.terms&.map(&:to_yaml_hash)
end
|
#text_content ⇒ Object
90
91
92
93
94
95
96
|
# File 'lib/glossarist/concept_data.rb', line 90
def text_content
texts = []
definition.each { |d| texts << d.content if d.content }
notes.each { |n| texts << n.content if n.content }
examples.each { |e| texts << e.content if e.content }
texts
end
|