module SimpleCov::Combine::LinesCombiner

def combine(coverage_a, coverage_b)

passed into a second merge).
(e.g. the parsed `coverage` key of a resultset hash being
which could surprise callers holding a reference to that array
implementation mutated whichever input was longer in place,
Build a fresh array sized to the longer input. The previous
def combine(coverage_a, coverage_b)
  size = [coverage_a.size, coverage_b.size].max
  Array.new(size) { |i| merge_line_coverage(coverage_a[i], coverage_b[i]) }
end

def merge_line_coverage(first_val, second_val)

Returns:
  • (Integer || nil) -

Parameters:
  • second_val (Integer || nil) --
  • first_val (Integer || nil) --
def merge_line_coverage(first_val, second_val)
  return nil if first_val.nil? && second_val.nil?
  first_val.to_i + second_val.to_i
end