Class: Rcov::TextReport

Inherits:
TextSummary show all
Defined in:
lib/rcov/report.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Formatter

Formatter::DEFAULT_OPTS

Instance Method Summary collapse

Methods inherited from TextSummary

#summary

Methods inherited from Formatter

#add_file, #code_coverage, #each_file_pair_sorted, #initialize, #mangle_filename, #normalize_filename, #num_code_lines, #num_lines, #sorted_file_pairs, #total_coverage

Constructor Details

This class inherits a constructor from Rcov::Formatter

Instance Method Details

#executeObject



270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/rcov/report.rb', line 270

def execute
    print_lines
    print_header
    print_lines
    each_file_pair_sorted do |fname, finfo|
        name = fname.size < 52 ? fname : "..." + fname[-48..-1]
        print_info(name, finfo.num_lines, finfo.num_code_lines,
                   finfo.code_coverage)
    end
    print_lines
    print_info("Total", num_lines, num_code_lines, code_coverage)
    print_lines
    puts summary
end


293
294
295
# File 'lib/rcov/report.rb', line 293

def print_header
    puts "|                  File                              | Lines |  LOC  |  COV   |"
end


285
286
287
# File 'lib/rcov/report.rb', line 285

def print_info(name, lines, loc, coverage)
    puts "|%-51s | %5d | %5d | %5.1f%% |" % [name, lines, loc, 100 * coverage]
end


289
290
291
# File 'lib/rcov/report.rb', line 289

def print_lines
    puts "+----------------------------------------------------+-------+-------+--------+"
end