Method: Covered::Coverage#mark
- Defined in:
- lib/covered/coverage.rb
#mark(line_number, value = 1) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/covered/coverage.rb', line 56 def mark(line_number, value = 1) # As currently implemented, @counts is base-zero rather than base-one. # Line numbers generally start at line 1, so the first line, line 1, is at index 1. This means that index[0] is usually nil. Array(value).each_with_index do |value, index| offset = line_number + index if @counts[offset] @counts[offset] += value else @counts[offset] = value end end end |