Class: GoldenRose::Generators::HtmlFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/golden_rose/generators/html_format.rb

Instance Method Summary collapse

Constructor Details

#initialize(results, output_path = nil) ⇒ HtmlFormat

Returns a new instance of HtmlFormat.



10
11
12
13
14
# File 'lib/golden_rose/generators/html_format.rb', line 10

def initialize(results, output_path = nil)
  @details     = results.details
  @items       = results.items
  @output_path = output_path || ""
end

Instance Method Details

#outputObject



16
17
18
19
20
21
22
23
# File 'lib/golden_rose/generators/html_format.rb', line 16

def output
  file_path = Pathname(@output_path) + "index.html"
  file = File.new(file_path, "w+")
  template_path = File.join(GoldenRose::root, "/lib/golden_rose/templates/index.haml")
  template = Tilt::HamlTemplate.new(template_path)
  file.puts template.render(self)
  file.close
end