Class: Coradoc::Html::Spa::Configuration
- Inherits:
-
ConverterBase::ConfigurationBase
- Object
- ConverterBase::ConfigurationBase
- Coradoc::Html::Spa::Configuration
- Defined in:
- lib/coradoc/html/spa.rb
Instance Attribute Summary collapse
-
#dist_dir ⇒ Object
Returns the value of attribute dist_dir.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#reading_progress ⇒ Object
Returns the value of attribute reading_progress.
-
#template_dirs ⇒ Object
Returns the value of attribute template_dirs.
-
#theme_toggle ⇒ Object
Returns the value of attribute theme_toggle.
-
#toc_levels ⇒ Object
Returns the value of attribute toc_levels.
-
#toc_sticky ⇒ Object
Returns the value of attribute toc_sticky.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Configuration
constructor
A new instance of Configuration.
- #to_h ⇒ Object
- #validate! ⇒ Object
Methods inherited from ConverterBase::ConfigurationBase
Constructor Details
#initialize(**options) ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 |
# File 'lib/coradoc/html/spa.rb', line 19 def initialize(**) @theme_toggle = .fetch(:theme_toggle, true) @reading_progress = .fetch(:reading_progress, true) @toc_sticky = .fetch(:toc_sticky, true) @toc_levels = [:toc_levels] || 2 @lang = [:lang] || 'en' @template_dirs = [:template_dirs] @dist_dir = [:dist_dir] end |
Instance Attribute Details
#dist_dir ⇒ Object
Returns the value of attribute dist_dir.
15 16 17 |
# File 'lib/coradoc/html/spa.rb', line 15 def dist_dir @dist_dir end |
#lang ⇒ Object
Returns the value of attribute lang.
15 16 17 |
# File 'lib/coradoc/html/spa.rb', line 15 def lang @lang end |
#reading_progress ⇒ Object
Returns the value of attribute reading_progress.
15 16 17 |
# File 'lib/coradoc/html/spa.rb', line 15 def reading_progress @reading_progress end |
#template_dirs ⇒ Object
Returns the value of attribute template_dirs.
15 16 17 |
# File 'lib/coradoc/html/spa.rb', line 15 def template_dirs @template_dirs end |
#theme_toggle ⇒ Object
Returns the value of attribute theme_toggle.
15 16 17 |
# File 'lib/coradoc/html/spa.rb', line 15 def theme_toggle @theme_toggle end |
#toc_levels ⇒ Object
Returns the value of attribute toc_levels.
15 16 17 |
# File 'lib/coradoc/html/spa.rb', line 15 def toc_levels @toc_levels end |
#toc_sticky ⇒ Object
Returns the value of attribute toc_sticky.
15 16 17 |
# File 'lib/coradoc/html/spa.rb', line 15 def toc_sticky @toc_sticky end |
Instance Method Details
#to_h ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/coradoc/html/spa.rb', line 29 def to_h { theme_toggle: @theme_toggle, reading_progress: @reading_progress, toc_sticky: @toc_sticky, toc_levels: @toc_levels, lang: @lang, template_dirs: @template_dirs, dist_dir: @dist_dir } end |
#validate! ⇒ Object
37 38 39 40 41 42 |
# File 'lib/coradoc/html/spa.rb', line 37 def validate! return if @toc_levels.is_a?(Integer) && @toc_levels.between?(1, 5) raise ConverterBase::ValidationError, 'TOC levels must be an integer between 1 and 5' end |