class Coverage::HTMLPrinter::Detail

Attributes

page_title[R]
path[R]
project_name[R]

Public Class Methods

new(path_settings, project_name, path, counts) click to toggle source
# File lib/coverage/html_printer.rb, line 155
def initialize(path_settings, project_name, path, counts)
  @path_settings = path_settings
  @project_name = project_name
  @path = path
  @counts = counts
  @statistics = Coverage::Statistics.new(path, counts)
  @source = Pathname(path)
  @page_title = @source.basename
  @sources = []
  @source.each_line.with_index.zip(@counts) do |(line, index), count|
    @sources << Line.new(index + 1, line, count)
  end
end

Public Instance Methods

code_coverage() click to toggle source
# File lib/coverage/html_printer.rb, line 203
def code_coverage
  coverage_bar(@statistics.code_coverage)
end
each_line() { |line| ... } click to toggle source
# File lib/coverage/html_printer.rb, line 179
def each_line
  @sources.each do |line|
    yield line
  end
end
html_filename() click to toggle source
# File lib/coverage/html_printer.rb, line 193
def html_filename
  dir = @source.sub(Regexp.new(@path_settings.base_directory.to_s), '.').dirname
  file = @source.basename.sub(/\.rb/, "_rb.html")
  dir + file
end
label() click to toggle source
# File lib/coverage/html_printer.rb, line 185
def label
  @label ||= @source.relative_path_from(@path_settings.output_directory).to_s.sub(/\A\.\.\//, '')
end
print() click to toggle source
total_coverage() click to toggle source
# File lib/coverage/html_printer.rb, line 199
def total_coverage
  coverage_bar(@statistics.total_coverage)
end

Private Instance Methods

output_directory() click to toggle source
# File lib/coverage/html_printer.rb, line 212
def output_directory
  @path_settings.output_directory
end
template_path() click to toggle source
# File lib/coverage/html_printer.rb, line 208
def template_path
  @path_settings.templates_directory + "detail.html.erb"
end