Class: Dictum::HtmlWriter
- Inherits:
-
Object
- Object
- Dictum::HtmlWriter
- Defined in:
- lib/dictum/html_writer.rb
Overview
rubocop:disable ClassLength
Constant Summary collapse
- ERROR_CODE_URL =
'error_codes'.freeze
- ERROR_CODE_TEXT =
'Error codes'.freeze
- RESOURCES_TEXT =
'Resources'.freeze
- BACK_TEXT =
'Back'.freeze
Instance Attribute Summary collapse
-
#header_title ⇒ Object
readonly
Returns the value of attribute header_title.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#temp_json ⇒ Object
readonly
Returns the value of attribute temp_json.
-
#temp_path ⇒ Object
readonly
Returns the value of attribute temp_path.
Instance Method Summary collapse
-
#initialize(output_dir, temp_path, config) ⇒ HtmlWriter
constructor
A new instance of HtmlWriter.
- #write ⇒ Object
Constructor Details
#initialize(output_dir, temp_path, config) ⇒ HtmlWriter
Returns a new instance of HtmlWriter.
15 16 17 18 19 20 21 |
# File 'lib/dictum/html_writer.rb', line 15 def initialize(output_dir, temp_path, config) @output_dir = output_dir @temp_path = temp_path @temp_json = JSON.parse(File.read(temp_path)) @config = config @header_title = config[:header_title] end |
Instance Attribute Details
#header_title ⇒ Object (readonly)
Returns the value of attribute header_title.
13 14 15 |
# File 'lib/dictum/html_writer.rb', line 13 def header_title @header_title end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
13 14 15 |
# File 'lib/dictum/html_writer.rb', line 13 def output_dir @output_dir end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
13 14 15 |
# File 'lib/dictum/html_writer.rb', line 13 def output_file @output_file end |
#temp_json ⇒ Object (readonly)
Returns the value of attribute temp_json.
13 14 15 |
# File 'lib/dictum/html_writer.rb', line 13 def temp_json @temp_json end |
#temp_path ⇒ Object (readonly)
Returns the value of attribute temp_path.
13 14 15 |
# File 'lib/dictum/html_writer.rb', line 13 def temp_path @temp_path end |
Instance Method Details
#write ⇒ Object
23 24 25 26 27 |
# File 'lib/dictum/html_writer.rb', line 23 def write Dir.mkdir(output_dir) unless Dir.exist?(output_dir) write_index write_pages end |