Class: Dictum::HtmlWriter
- Inherits:
-
Object
- Object
- Dictum::HtmlWriter
- Defined in:
- lib/dictum/html_writer.rb
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.
9 10 11 12 13 14 15 |
# File 'lib/dictum/html_writer.rb', line 9 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.
7 8 9 |
# File 'lib/dictum/html_writer.rb', line 7 def header_title @header_title end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
7 8 9 |
# File 'lib/dictum/html_writer.rb', line 7 def output_dir @output_dir end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
7 8 9 |
# File 'lib/dictum/html_writer.rb', line 7 def output_file @output_file end |
#temp_json ⇒ Object (readonly)
Returns the value of attribute temp_json.
7 8 9 |
# File 'lib/dictum/html_writer.rb', line 7 def temp_json @temp_json end |
#temp_path ⇒ Object (readonly)
Returns the value of attribute temp_path.
7 8 9 |
# File 'lib/dictum/html_writer.rb', line 7 def temp_path @temp_path end |
Instance Method Details
#write ⇒ Object
17 18 19 20 21 |
# File 'lib/dictum/html_writer.rb', line 17 def write Dir.mkdir(output_dir) unless Dir.exist?(output_dir) write_index write_pages end |