Class: Covered::PartialSummary
- Defined in:
- lib/covered/summary.rb
Instance Method Summary collapse
Methods inherited from Summary
#call, #each, #initialize, #print_annotations, #print_error, #print_line, #print_line_header, #terminal
Constructor Details
This class inherits a constructor from Covered::Summary
Instance Method Details
#print_coverage(terminal, coverage, before: 4, after: 4) ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/covered/summary.rb', line 167 def print_coverage(terminal, coverage, before: 4, after: 4) return if coverage.zero? line_offset = 1 counts = coverage.counts last_line = nil coverage.read do |file| print_line_header(terminal) file.each_line do |line| range = Range.new([line_offset - before, 0].max, line_offset+after) if counts[range]&.include?(0) count = counts[line_offset] if last_line and last_line != line_offset-1 terminal.puts ":".rjust(16) end print_annotations(terminal, coverage, line, line_offset) print_line(terminal, line, line_offset, count) last_line = line_offset end line_offset += 1 end end end |