Class: Glossarist::LocalizedConcept

Inherits:
Concept
  • Object
show all
Defined in:
lib/glossarist/localized_concept.rb

Constant Summary collapse

NIL_COLLECTION_KEYS =
%w[definition examples notes].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Concept

#authoritative_source, #date_accepted, #date_accepted_from_yaml, #date_accepted_to_yaml, #definition, #definition=, #designations, #examples, #id_from_yaml, #id_to_yaml, #notes, #preferred_designations, #sources, #sources=, #uuid, #uuid_from_yaml, #uuid_to_yaml

Class Method Details

.of_yaml(hash, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/glossarist/localized_concept.rb', line 14

def self.of_yaml(hash, options = {})
  if hash.is_a?(Hash) && (data = hash["data"]).is_a?(Hash)
    NIL_COLLECTION_KEYS.each do |key|
      data[key] = [] if data.key?(key) && data[key].nil?
    end
  end
  super
end

Instance Method Details

#entry_statusObject



29
30
31
# File 'lib/glossarist/localized_concept.rb', line 29

def entry_status
  data.entry_status
end

#entry_status=(value) ⇒ Object



37
38
39
# File 'lib/glossarist/localized_concept.rb', line 37

def entry_status=(value)
  data.entry_status = value
end

#language_codeObject



25
26
27
# File 'lib/glossarist/localized_concept.rb', line 25

def language_code
  data.language_code
end

#language_code=(value) ⇒ Object



33
34
35
# File 'lib/glossarist/localized_concept.rb', line 33

def language_code=(value)
  data.language_code = value
end

#status=Object



23
# File 'lib/glossarist/localized_concept.rb', line 23

alias_method :status=, :entry_status=