Class: Jekyll::GeneratorSingleSource::DocNavConfig
- Inherits:
-
Object
- Object
- Jekyll::GeneratorSingleSource::DocNavConfig
- Defined in:
- lib/jekyll/generator-single-source/doc_nav_config.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #assume_generated? ⇒ Boolean
- #config ⇒ Object
- #generate_pages ⇒ Object
-
#initialize(file_path, site) ⇒ DocNavConfig
constructor
A new instance of DocNavConfig.
- #items ⇒ Object
- #product ⇒ Object
- #release ⇒ Object
- #skip_generation? ⇒ Boolean
- #versions ⇒ Object
Constructor Details
#initialize(file_path, site) ⇒ DocNavConfig
Returns a new instance of DocNavConfig.
8 9 10 11 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 8 def initialize(file_path, site) @file_path = file_path @site = site end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
6 7 8 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 6 def file_path @file_path end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
6 7 8 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 6 def site @site end |
Instance Method Details
#assume_generated? ⇒ Boolean
19 20 21 22 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 19 def assume_generated? # Assume that the whole file should be treated as generated config['assume_generated'].nil? || config['assume_generated'] end |
#config ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 50 def config @config ||= begin config = NavConfig::Base.process(@file_path) Jekyll.logger.debug("generated config: #{config.to_json}") config end end |
#generate_pages ⇒ Object
44 45 46 47 48 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 44 def generate_pages return if skip_generation? items.map(&:generate_pages) end |
#items ⇒ Object
24 25 26 27 28 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 24 def items @items ||= (config.fetch('items', []) + ([config['unlisted']])) .flatten.compact .map { |i| DocNavItem::Base.make_for(i, self) } end |
#product ⇒ Object
30 31 32 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 30 def product @product ||= config['product'] end |
#release ⇒ Object
34 35 36 37 38 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 34 def release @release ||= edition.releases.detect do |r| r.value == config['release'] end end |
#skip_generation? ⇒ Boolean
13 14 15 16 17 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 13 def skip_generation? # skip if release is not available because it # was skipped using an ENV variable !(config.is_a?(Hash) && config['generate']) || release.nil? end |
#versions ⇒ Object
40 41 42 |
# File 'lib/jekyll/generator-single-source/doc_nav_config.rb', line 40 def versions @versions ||= release.versions end |