Class: Coco::HtmlIndexFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/coco/formatter/html_index_formatter.rb

Overview

I format the index.html

Instance Method Summary collapse

Constructor Details

#initialize(uncovered, result, threshold = 100) ⇒ HtmlIndexFormatter

uncovered - An Array list of uncovered files. result - CoverageResult. threshold - Fixnum.



13
14
15
16
17
18
19
20
21
22
# File 'lib/coco/formatter/html_index_formatter.rb', line 13

def initialize(uncovered, result, threshold = 100)
  @uncovered = uncovered
  @result = result
  @threshold = threshold
  @summary = Summary.new(result, uncovered)
  @context = nil
  @template = Template.open(File.join(Coco::ROOT, 'template/index.erb'))
  @lines = []
  build_lines_for_context
end

Instance Method Details

#formatObject



24
25
26
27
28
# File 'lib/coco/formatter/html_index_formatter.rb', line 24

def format
  @context = IndexContext.new(Helpers.index_title, @lines, uncovered_files,
                              @summary, @threshold)
  @template.result(@context.variables)
end