Class: Jekyll::Geolexica::ConceptSerializer

Inherits:
SimpleDelegator
  • Object
show all
Includes:
Configuration
Defined in:
lib/jekyll/geolexica/concept_serializer.rb

Overview

A decorator responsible for serializing concepts in the most simplistic machine-readable formats like JSON or YAML but unlike RDF ontologies.

Constant Summary collapse

NON_LANGUAGE_KEYS =
%w[term termid]

Instance Attribute Summary collapse

Instance Method Summary collapse

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(concept, site) ⇒ ConceptSerializer

Returns a new instance of ConceptSerializer.



16
17
18
19
# File 'lib/jekyll/geolexica/concept_serializer.rb', line 16

def initialize(concept, site)
  super(concept)
  @site = site
end

Instance Attribute Details

#siteObject (readonly)

A Jekyll::Site instance.



14
15
16
# File 'lib/jekyll/geolexica/concept_serializer.rb', line 14

def site
  @site
end

Instance Method Details

#to_jsonObject



21
22
23
# File 'lib/jekyll/geolexica/concept_serializer.rb', line 21

def to_json
  JSON.dump(in_all_languages)
end

#to_yamlObject



25
26
27
# File 'lib/jekyll/geolexica/concept_serializer.rb', line 25

def to_yaml
  YAML.dump(in_all_languages)
end