Class: Html2MarkdownCli
- Inherits:
-
Object
- Object
- Html2MarkdownCli
- Defined in:
- lib/html2markdown/html2markdown_cli.rb
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
Instance Method Summary collapse
- #convert_file(file_name) ⇒ Object
-
#initialize(output_dir = "#{Dir.pwd}/output") ⇒ Html2MarkdownCli
constructor
A new instance of Html2MarkdownCli.
Constructor Details
#initialize(output_dir = "#{Dir.pwd}/output") ⇒ Html2MarkdownCli
Returns a new instance of Html2MarkdownCli.
7 8 9 10 |
# File 'lib/html2markdown/html2markdown_cli.rb', line 7 def initialize(output_dir = "#{Dir.pwd}/output") @output_dir = output_dir create_dir(output_dir) end |
Instance Attribute Details
#output_dir ⇒ Object
Returns the value of attribute output_dir.
5 6 7 |
# File 'lib/html2markdown/html2markdown_cli.rb', line 5 def output_dir @output_dir end |
Instance Method Details
#convert_file(file_name) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/html2markdown/html2markdown_cli.rb', line 12 def convert_file(file_name) reverse_md = ReverseMarkdown.new contents = File.open(file_name).read markdown = reverse_md.parse_string(contents) write_file(file_name, markdown, output_dir) end |