Class: Markup::Runner
- Inherits:
-
Object
- Object
- Markup::Runner
- Defined in:
- lib/markup.rb
Defined Under Namespace
Classes: OutputExists
Instance Method Summary collapse
- #generate_html! ⇒ Object
-
#initialize(source, options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #output_filename ⇒ Object
Constructor Details
#initialize(source, options = {}) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 |
# File 'lib/markup.rb', line 8 def initialize(source, = {}) @source = source @options = end |
Instance Method Details
#generate_html! ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/markup.rb', line 13 def generate_html! if output_file_exists? && should_not_overwrite_output_file? raise OutputExists, output_filename else File.open(output_filename, 'w') { |f| f.write(html_output) } end end |
#output_filename ⇒ Object
21 22 23 |
# File 'lib/markup.rb', line 21 def output_filename @options[:output] || File.basename(@source, '.*') + '.html' end |