Class: Glossarist::LocalizedConcept
- Defined in:
- lib/glossarist/localized_concept.rb
Instance Attribute Summary collapse
-
#classification ⇒ String
Must be one of the following:
preferred
,admitted
,deprecated
. -
#entry_status ⇒ String
Must be one of the following:
notValid
,valid
,superseded
,retired
. -
#language_code ⇒ String
ISO 639-2 code for terminology.
-
#review_date ⇒ Object
Returns the value of attribute review_date.
-
#review_decision_date ⇒ Object
Returns the value of attribute review_decision_date.
-
#review_decision_event ⇒ Object
Returns the value of attribute review_decision_event.
Attributes inherited from Concept
#dates, #definition, #designations, #domain, #examples, #extension_attributes, #id, #non_verb_rep, #notes, #sources, #subject
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ LocalizedConcept
constructor
A new instance of LocalizedConcept.
-
#to_h ⇒ Object
(also: #to_hash)
rubocop:disable Metrics/MethodLength.
Methods inherited from Concept
#authoritative_source=, #related, #related=
Methods inherited from Model
Constructor Details
#initialize ⇒ LocalizedConcept
Returns a new instance of LocalizedConcept.
31 32 33 34 35 |
# File 'lib/glossarist/localized_concept.rb', line 31 def initialize(*) @examples = [] super end |
Instance Attribute Details
#classification ⇒ String
Proper type checking.
Works with strings, but soon they may be replaced with symbols.
Must be one of the following: preferred
, admitted
, deprecated
.
25 26 27 |
# File 'lib/glossarist/localized_concept.rb', line 25 def classification @classification end |
#entry_status ⇒ String
Proper type checking.
Works with strings, but soon they may be replaced with symbols.
Must be one of the following: notValid
, valid
, superseded
, retired
.
18 19 20 |
# File 'lib/glossarist/localized_concept.rb', line 18 def entry_status @entry_status end |
#language_code ⇒ String
ISO 639-2 code for terminology.
11 12 13 |
# File 'lib/glossarist/localized_concept.rb', line 11 def language_code @language_code end |
#review_date ⇒ Object
Returns the value of attribute review_date.
27 28 29 |
# File 'lib/glossarist/localized_concept.rb', line 27 def review_date @review_date end |
#review_decision_date ⇒ Object
Returns the value of attribute review_decision_date.
28 29 30 |
# File 'lib/glossarist/localized_concept.rb', line 28 def review_decision_date @review_decision_date end |
#review_decision_event ⇒ Object
Returns the value of attribute review_decision_event.
29 30 31 |
# File 'lib/glossarist/localized_concept.rb', line 29 def review_decision_event @review_decision_event end |
Class Method Details
.from_h(hash) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/glossarist/localized_concept.rb', line 50 def self.from_h(hash) terms = hash["terms"]&.map { |h| Designation::Base.from_h(h) } || [] sources = hash["authoritative_source"]&.each { |source| source.merge({ "type" => "authoritative"}) } super(hash.merge({"terms" => terms, "sources" => sources})) end |
Instance Method Details
#to_h ⇒ Object Also known as: to_hash
rubocop:disable Metrics/MethodLength
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/glossarist/localized_concept.rb', line 37 def to_h # rubocop:disable Metrics/MethodLength super.merge({ "language_code" => language_code, "entry_status" => entry_status, "sources" => sources.empty? ? nil : sources&.map(&:to_h), "classification" => classification, "dates" => dates&.map(&:to_h), "review_date" => review_date, "review_decision_date" => review_decision_date, "review_decision_event" => review_decision_event, }.compact).merge(@extension_attributes) end |