class Glossarist::LocalizedConcept

Attributes

authoritative_source[RW]

@todo Right now accepts hashes for legacy reasons, but they will be

replaced with dedicated classes.

@todo Alias authoritative_source exists for legacy reasons and may be

removed.

@return [Array<Hash>]

authoritative_source=[RW]

@todo Right now accepts hashes for legacy reasons, but they will be

replaced with dedicated classes.

@todo Alias authoritative_source exists for legacy reasons and may be

removed.

@return [Array<Hash>]

classification[RW]

Must be one of the following: preferred, admitted, deprecated. @todo Proper type checking. @note Works with strings, but soon they may be replaced with symbols. @return [String]

date_accepted[RW]
date_amended[RW]
definition[RW]

Concept definition. @todo Support multiple definitions. @return [String]

designations[RW]

Concept designations. @todo Alias terms exists only for legacy reasons and will be removed. @return [Array<Designations::Base>]

entry_status[RW]

Must be one of the following: notValid, valid, superseded, retired. @todo Proper type checking. @note Works with strings, but soon they may be replaced with symbols. @return [String]

examples[RW]

@return [Array<String>]

id[RW]

Needs to be identical with {Concept#id}. @todo Here for legacy reasons. Will be removed eventually.

language_code[RW]

ISO 639-2 code for terminology. @see www.loc.gov/standards/iso639-2/php/code_list.php code list @return [String]

notes[RW]

@return [Array<String>]

review_date[RW]
review_decision_date[RW]
review_decision_event[RW]
sources[RW]

@todo Right now accepts hashes for legacy reasons, but they will be

replaced with dedicated classes.

@todo Alias authoritative_source exists for legacy reasons and may be

removed.

@return [Array<Hash>]

superseded_concepts[RW]

@todo Here for legacy reasons. Will be moved to Concept. @todo Right now is an array of hashes for legacy reasons, but these hashes

will be replaced with some dedicated class.

@todo Should be read-only, but for now it is not for legacy reasons.

Don't use the setter.

@return [Array<Hash>]

terms[RW]

Concept designations. @todo Alias terms exists only for legacy reasons and will be removed. @return [Array<Designations::Base>]

terms=[RW]

Concept designations. @todo Alias terms exists only for legacy reasons and will be removed. @return [Array<Designations::Base>]

Public Class Methods

from_h(hash) click to toggle source
Calls superclass method
# File lib/glossarist/localized_concept.rb, line 101
def self.from_h(hash)
  terms = hash["terms"]&.map { |h| Designations::Base.from_h(h) } || []
  super(hash.merge({"terms" => terms}))
end
new(*) click to toggle source
Calls superclass method
# File lib/glossarist/localized_concept.rb, line 73
def initialize(*)
  @examples = []
  @notes = []
  @designations = []
  @superseded_concepts = []
  @sources = []
  super
end

Public Instance Methods

to_h() click to toggle source
# File lib/glossarist/localized_concept.rb, line 82
def to_h # rubocop:disable Metrics/MethodLength
  {
    "id" => id,
    "terms" => (terms&.map(&:to_h) || []),
    "definition" => definition,
    "language_code" => language_code,
    "notes" => notes,
    "examples" => examples,
    "entry_status" => entry_status,
    "classification" => classification,
    "authoritative_source" => (sources if sources&.any?),
    "date_accepted" => date_accepted,
    "date_amended" => date_amended,
    "review_date" => review_date,
    "review_decision_date" => review_decision_date,
    "review_decision_event" => review_decision_event,
  }.compact
end
Also aliased as: to_hash
to_hash()

@deprecated For legacy reasons only.

Implicit conversion (i.e. {#to_hash} alias) will be removed soon.
Alias for: to_h