Sha256: 4327e531d2233ca5ffab1ba768d09594422ab7e909008637d056545d36bf6458
Contents?: true
Size: 941 Bytes
Versions: 1
Compression:
Stored size: 941 Bytes
Contents
# -*- encoding: utf-8 -*- require 'erb' module Coco # I format coverages information into html files. # @todo document and change name to HtmlFilesFormatter class HtmlFormatter < Formatter def initialize raw_coverages super(raw_coverages, []) @formatted_output_files = {} @context = nil @template = Template.open File.join($COCO_PATH,'template/file.erb') end def format @raw_coverages.each do |filename, coverage| build_html filename, coverage end @formatted_output_files end private def build_html filename, coverage source = File.readlines filename lines = [] source.each_with_index do |line, index| lines << [index+1, line.chomp, coverage[index]] end @context = Context.new filename, lines @formatted_output_files[filename] = @template.result(@context.get_binding) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coco-0.4.1 | lib/coco/formatter/html_formatter.rb |