Class: ResumeArrayFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/teuton/report/formatter/resume/array.rb

Instance Attribute Summary

Attributes inherited from BaseFormatter

#ext

Instance Method Summary collapse

Methods inherited from BaseFormatter

#deinit, #init, #trim, #w

Constructor Details

#initialize(report) ⇒ ResumeArrayFormatter

Returns a new instance of ResumeArrayFormatter.



4
5
6
7
# File 'lib/teuton/report/formatter/resume/array.rb', line 4

def initialize(report)
  super(report)
  @data = {}
end

Instance Method Details

#build_cases_dataObject



28
29
30
# File 'lib/teuton/report/formatter/resume/array.rb', line 28

def build_cases_data
  @data[:cases] = @lines
end

#build_data(options) ⇒ Object



15
16
17
18
19
20
# File 'lib/teuton/report/formatter/resume/array.rb', line 15

def build_data(options)
  build_initial_data
  build_cases_data
  build_final_data
  build_hof_data
end

#build_final_dataObject



32
33
34
35
36
# File 'lib/teuton/report/formatter/resume/array.rb', line 32

def build_final_data
  tail = {}
  @tail.each { |key, value| tail[key] = value }
  @data[:results] = tail
end

#build_hof_dataObject



38
39
40
41
42
43
44
45
# File 'lib/teuton/report/formatter/resume/array.rb', line 38

def build_hof_data
  app = Application.instance
  fame = {}
  if app.options[:case_number] > 2
    app.hall_of_fame.each { |line| fame[line[0]] = line[1] }
  end
  @data[:hall_of_fame] = fame
end

#build_initial_dataObject



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

def build_initial_data
  head = {}
  @head.each { |key, value| head[key] = value }
  @data[:config] = head
end

#process(options = {}) ⇒ Object



9
10
11
12
13
# File 'lib/teuton/report/formatter/resume/array.rb', line 9

def process(options = {})
  build_data(options)
  w @data.to_s # Write data into ouput file
  deinit
end