Class: Jekyll::GeneratorSingleSource::GeneratorConfig
- Inherits:
-
Object
- Object
- Jekyll::GeneratorSingleSource::GeneratorConfig
- Defined in:
- lib/jekyll/generator-single-source/generator_config.rb
Constant Summary collapse
- CONFIG_KEY =
'jekyll-generator-single-source'
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #base_dest_path ⇒ Object
- #build_docs_nav(edition:, release: nil) ⇒ Object
- #docs_nav_folder ⇒ Object
- #editions ⇒ Object
-
#initialize(site) ⇒ GeneratorConfig
constructor
A new instance of GeneratorConfig.
- #layout ⇒ Object
- #multiple_products? ⇒ Boolean
- #versions_file ⇒ Object
Constructor Details
#initialize(site) ⇒ GeneratorConfig
Returns a new instance of GeneratorConfig.
10 11 12 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 10 def initialize(site) @site = site end |
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
8 9 10 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 8 def site @site end |
Instance Method Details
#base_dest_path ⇒ Object
36 37 38 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 36 def base_dest_path config['base_dest_path'] end |
#build_docs_nav(edition:, release: nil) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 40 def build_docs_nav(edition:, release: nil) file = release.nil? ? "docs_nav_#{edition}.yml" :"docs_nav_#{edition}_#{release}.yml" i18n_file = I18nFile.new( file: file, src_path: config.fetch('docs_nav_folder'), locale: @site.config['locale'], site: ) DocNavConfig.new(i18n_file: i18n_file, site: @site) end |
#docs_nav_folder ⇒ Object
28 29 30 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 28 def docs_nav_folder File.(config.fetch('docs_nav_folder'), @site.source) end |
#editions ⇒ Object
14 15 16 17 18 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 14 def editions @editions ||= SafeYAML.load(File.read( File.(versions_file, @site.source) )).group_by { |e| e['edition'] } end |
#layout ⇒ Object
20 21 22 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 20 def layout config['layout'] || 'docs-v2' end |
#multiple_products? ⇒ Boolean
32 33 34 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 32 def multiple_products? !!config.fetch('multiple_products', true) end |
#versions_file ⇒ Object
24 25 26 |
# File 'lib/jekyll/generator-single-source/generator_config.rb', line 24 def versions_file config['versions_file'] end |