Class: Glossarist::V2::Citation

Inherits:
Citation
  • Object
show all
Defined in:
lib/glossarist/v2/citation.rb

Instance Method Summary collapse

Methods inherited from Citation

#locality_from_yaml, #locality_to_yaml

Instance Method Details

#labelObject



18
19
20
# File 'lib/glossarist/v2/citation.rb', line 18

def label
  text
end

#ref_from_yaml(model, value) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/glossarist/v2/citation.rb', line 22

def ref_from_yaml(model, value)
  model.text = case value
               when Hash
                 value["source"] || value[:source]
               when String
                 value
               end
end

#ref_to_yaml(model, doc) ⇒ Object



31
32
33
# File 'lib/glossarist/v2/citation.rb', line 31

def ref_to_yaml(model, doc)
  doc["ref"] = model.text if model.text
end