Class: Coradoc::Html::Static::Configuration
- Inherits:
-
ConverterBase::ConfigurationBase
- Object
- ConverterBase::ConfigurationBase
- Coradoc::Html::Static::Configuration
- Defined in:
- lib/coradoc/html/static.rb
Instance Attribute Summary collapse
-
#custom_css ⇒ Object
Returns the value of attribute custom_css.
-
#embedded ⇒ Object
Returns the value of attribute embedded.
-
#include_toc ⇒ Object
Returns the value of attribute include_toc.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#meta_tags ⇒ Object
Returns the value of attribute meta_tags.
-
#section_numbering ⇒ Object
Returns the value of attribute section_numbering.
-
#section_numbering_levels ⇒ Object
Returns the value of attribute section_numbering_levels.
-
#template_dirs ⇒ Object
Returns the value of attribute template_dirs.
-
#toc_levels ⇒ Object
Returns the value of attribute toc_levels.
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.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/coradoc/html/static.rb', line 20 def initialize(**) @include_toc = .fetch(:include_toc, false) @toc_levels = [:toc_levels] || 2 @section_numbering = .fetch(:section_numbering, false) @section_numbering_levels = [:section_numbering_levels] || 3 @lang = [:lang] || 'en' @meta_tags = [:meta_tags] || {} @custom_css = [:custom_css] @embedded = .fetch(:embedded, false) @template_dirs = [:template_dirs] end |
Instance Attribute Details
#custom_css ⇒ Object
Returns the value of attribute custom_css.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def custom_css @custom_css end |
#embedded ⇒ Object
Returns the value of attribute embedded.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def @embedded end |
#include_toc ⇒ Object
Returns the value of attribute include_toc.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def include_toc @include_toc end |
#lang ⇒ Object
Returns the value of attribute lang.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def lang @lang end |
#meta_tags ⇒ Object
Returns the value of attribute meta_tags.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def @meta_tags end |
#section_numbering ⇒ Object
Returns the value of attribute section_numbering.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def section_numbering @section_numbering end |
#section_numbering_levels ⇒ Object
Returns the value of attribute section_numbering_levels.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def section_numbering_levels @section_numbering_levels end |
#template_dirs ⇒ Object
Returns the value of attribute template_dirs.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def template_dirs @template_dirs end |
#toc_levels ⇒ Object
Returns the value of attribute toc_levels.
15 16 17 |
# File 'lib/coradoc/html/static.rb', line 15 def toc_levels @toc_levels end |
Instance Method Details
#to_h ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/coradoc/html/static.rb', line 32 def to_h { include_toc: @include_toc, toc_levels: @toc_levels, section_numbering: @section_numbering, section_numbering_levels: @section_numbering_levels, lang: @lang, meta_tags: @meta_tags, custom_css: @custom_css, embedded: @embedded, template_dirs: @template_dirs } end |
#validate! ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/coradoc/html/static.rb', line 42 def validate! unless @toc_levels.is_a?(Integer) && @toc_levels.between?(1, 5) raise ConverterBase::ValidationError, 'TOC levels must be an integer between 1 and 5' end unless @section_numbering_levels.is_a?(Integer) && @section_numbering_levels.between?(1, 6) raise ConverterBase::ValidationError, 'Section numbering levels must be an integer between 1 and 6' end end |