Class: HTMLFormatter

Inherits:
YAMLFormatter show all
Defined in:
lib/teuton/report/formatter/html_formatter.rb

Overview

HTMLFormatter class receive a [Report] and generates HAML output.

Instance Method Summary collapse

Methods inherited from ArrayFormatter

#build_data, #build_final_data, #build_history_data, #build_hof_data, #build_initial_data

Methods inherited from BaseFormatter

#deinit, #init, #trim, #w

Constructor Details

#initialize(report) ⇒ HTMLFormatter

Class constructor

Parameters:

  • report (Report)

    Parent object that contains data to be exported.



13
14
15
16
17
18
# File 'lib/teuton/report/formatter/html_formatter.rb', line 13

def initialize(report)
  super(report)
  @data = {}
  filepath = File.join(File.dirname(__FILE__), '..', '..', 'files', 'template', 'case.html')
  @template = File.read(filepath)
end

Instance Method Details

#build_pageObject

Build html case page



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/teuton/report/formatter/html_formatter.rb', line 30

def build_page
  config = @data[:config]
  results = @data[:results]
  logs = @data[:logs]
  groups = @data[:groups]
  groups = @data[:groups]
  hall_of_fame = @data[:hall_of_fame]
  version = Application::VERSION
  renderer = ERB.new(@template)
  w renderer.result(binding)
end

#processObject

Process data from parent object and export it into YAML format.



22
23
24
25
26
# File 'lib/teuton/report/formatter/html_formatter.rb', line 22

def process
  build_data
  build_page
  deinit
end