Class: Jekyll::Geolexica::Glossary
- Inherits:
-
Hash
- Object
- Hash
- Jekyll::Geolexica::Glossary
- Includes:
- Configuration
- Defined in:
- lib/jekyll/geolexica/glossary.rb
Defined Under Namespace
Classes: Concept
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
-
#initialize(site) ⇒ Glossary
constructor
A new instance of Glossary.
- #language_statistics ⇒ Object
- #load_glossary ⇒ Object
- #store(concept) ⇒ Object
-
#to_liquid ⇒ Object
Defines how Glossary is exposed in Liquid templates.
Methods included from Configuration
#bibliography_path, #concepts_glob, #glossary_format, #glossary_path, #images_metadata_path, #images_path, #localized_concepts_path, #output_html?, #output_json?, #output_jsonld?, #output_tbx?, #output_turtle?, #output_yaml?, #report_issue_url, #suggest_translation_url, #term_languages
Constructor Details
#initialize(site) ⇒ Glossary
Returns a new instance of Glossary.
14 15 16 17 |
# File 'lib/jekyll/geolexica/glossary.rb', line 14 def initialize(site) @site = site @collection = Glossarist::ManagedConceptCollection.new end |
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
9 10 11 |
# File 'lib/jekyll/geolexica/glossary.rb', line 9 def site @site end |
Instance Method Details
#language_statistics ⇒ Object
44 45 46 |
# File 'lib/jekyll/geolexica/glossary.rb', line 44 def language_statistics @language_statistics ||= calculate_language_statistics end |
#load_glossary ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jekyll/geolexica/glossary.rb', line 19 def load_glossary Jekyll.logger.info('Geolexica:', 'Loading concepts') @collection.load_from_files(glossary_path) @collection.each do |managed_concept| concept_hash = { "id" => managed_concept.uuid, "term" => managed_concept.default_designation, "termid" => managed_concept.id, "status" => managed_concept.status, }.merge(managed_concept.to_h) managed_concept.localizations.each do |lang, localization| concept_hash[lang] = localization.to_h["data"] end preprocess_concept_hash(concept_hash) store(Concept.new(concept_hash)) end end |
#store(concept) ⇒ Object
40 41 42 |
# File 'lib/jekyll/geolexica/glossary.rb', line 40 def store(concept) super(concept.data['termid'], concept) end |
#to_liquid ⇒ Object
Defines how Glossary is exposed in Liquid templates.
49 50 51 52 53 |
# File 'lib/jekyll/geolexica/glossary.rb', line 49 def to_liquid { 'language_statistics' => language_statistics } end |