Class: Coco::HtmlIndexFormatter

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

Overview

I format the index.html

Instance Method Summary collapse

Constructor Details

#initialize(raw_coverages, uncovered) ⇒ HtmlIndexFormatter

Returns a new instance of HtmlIndexFormatter.


10
11
12
13
14
15
16
# File 'lib/coco/formatter/html_index_formatter.rb', line 10

def initialize(raw_coverages, uncovered)
  super
  @context = nil
  @template = Template.open File.join(Coco::ROOT, 'template/index.erb')
  @lines = []
  build_lines_for_context
end

Instance Method Details

#formatObject


18
19
20
21
22
23
# File 'lib/coco/formatter/html_index_formatter.rb', line 18

def format
  @context = IndexContext.new(Helpers.index_title,
                              @lines,
                              @uncovered.map{|e| emphasize(e) })
  @template.result(@context.get_binding)
end