Sha256: cefc0e30b55b8f9f7986e8102e339c00b7ffde78747d468b6305f057e039968b
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module Rcov module Formatters class HtmlErbTemplate attr_accessor :local_variables def initialize(template_file, locals={}) require "erb" template_path = File.expand_path("#{File.dirname(__FILE__)}/../templates/#{template_file}") @template = ERB.new(File.read(template_path)) @local_variables = locals @path_relativizer = Hash.new{|h,base| h[base] = Pathname.new(base).cleanpath.to_s.gsub(%r{^\w:[/\\]}, "").gsub(/\./, "_").gsub(/[\\\/]/, "-") + ".html" } end def render @template.result(get_binding) end def relative_filename(path) @path_relativizer[path] end def line_css(line_number) case fileinfo.coverage[line_number] when true "marked" when :inferred "inferred" else "uncovered" end end def method_missing(key, *args) local_variables.has_key?(key) ? local_variables[key] : super end def get_binding binding end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
gigpark-rcov-0.8.6 | lib/rcov/formatters/html_erb_template.rb |
relevance-rcov-0.8.6 | lib/rcov/formatters/html_erb_template.rb |