Class: Dictum::MarkdownWriter
- Inherits:
-
Object
- Object
- Dictum::MarkdownWriter
- Defined in:
- lib/dictum/markdown_writer.rb
Instance Attribute Summary collapse
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#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_path, temp_path, config) ⇒ MarkdownWriter
constructor
A new instance of MarkdownWriter.
- #write ⇒ Object
Constructor Details
#initialize(output_path, temp_path, config) ⇒ MarkdownWriter
Returns a new instance of MarkdownWriter.
7 8 9 10 11 12 13 |
# File 'lib/dictum/markdown_writer.rb', line 7 def initialize(output_path, temp_path, config) @output_path = "#{output_path}.md" File.delete(@output_path) if File.exist?(@output_path) @temp_path = temp_path @temp_json = JSON.parse(File.read(temp_path)) @config = config end |
Instance Attribute Details
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
5 6 7 |
# File 'lib/dictum/markdown_writer.rb', line 5 def output_file @output_file end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
5 6 7 |
# File 'lib/dictum/markdown_writer.rb', line 5 def output_path @output_path end |
#temp_json ⇒ Object (readonly)
Returns the value of attribute temp_json.
5 6 7 |
# File 'lib/dictum/markdown_writer.rb', line 5 def temp_json @temp_json end |
#temp_path ⇒ Object (readonly)
Returns the value of attribute temp_path.
5 6 7 |
# File 'lib/dictum/markdown_writer.rb', line 5 def temp_path @temp_path end |
Instance Method Details
#write ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/dictum/markdown_writer.rb', line 15 def write @output_file = File.open(output_path, 'a+') write_index write_temp_path write_error_codes output_file.close end |