Class: Rcov::TextReport
- Inherits:
-
TextSummary
- Object
- BaseFormatter
- TextSummary
- Rcov::TextReport
- Defined in:
- lib/rcov/formatters/text_report.rb
Overview
:nodoc:
Constant Summary
Constants inherited from BaseFormatter
BaseFormatter::DEFAULT_OPTS, BaseFormatter::RCOV_IGNORE_REGEXPS
Instance Method Summary collapse
- #execute ⇒ Object
- #print_header ⇒ Object
- #print_info(name, lines, loc, coverage) ⇒ Object
- #print_lines ⇒ Object
Methods inherited from TextSummary
Methods inherited from BaseFormatter
#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::BaseFormatter
Instance Method Details
#execute ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rcov/formatters/text_report.rb', line 3 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 |
#print_header ⇒ Object
28 29 30 |
# File 'lib/rcov/formatters/text_report.rb', line 28 def print_header puts "| File | Lines | LOC | COV |" end |
#print_info(name, lines, loc, coverage) ⇒ Object
20 21 22 |
# File 'lib/rcov/formatters/text_report.rb', line 20 def print_info(name, lines, loc, coverage) puts "|%-51s | %5d | %5d | %5.1f%% |" % [name, lines, loc, 100 * coverage] end |
#print_lines ⇒ Object
24 25 26 |
# File 'lib/rcov/formatters/text_report.rb', line 24 def print_lines puts "+----------------------------------------------------+-------+-------+--------+" end |