Sha256: 5c851f2bd92eb42b49051f4fc9369d6c8cf62b5ba86ca97e2e8299a34ef17d04
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require 'erb' module Coco # I format the index.html # class HtmlIndexFormatter # uncovered - An Array list of uncovered files. # result - CoverageResult. # threshold - Fixnum. # 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 def format @context = IndexContext.new(Helpers.index_title, @lines, uncovered_files, @summary, @threshold) @template.result(@context.variables) end private def build_lines_for_context @result.coverable_files.to_a.each do |filename, coverage| @lines << IndexLine.build(filename, coverage) end @lines.sort! end def uncovered_files @uncovered.map { |filename| Helpers.name_for_html(filename) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
coco-0.15.0 | lib/coco/formatter/html_index_formatter.rb |
coco-0.14.0 | lib/coco/formatter/html_index_formatter.rb |