Module: SimpleCov::Combine::MethodsCombiner

Defined in:
lib/simplecov/combine/methods_combiner.rb

Overview

Combine different method coverage results on a single file.

Should be called through ‘SimpleCov.combine`.

Class Method Summary collapse

Class Method Details

.combine(coverage_a, coverage_b) ⇒ Hash

Return merged methods or the existing methods if other is missing.

Method coverage is a flat hash mapping method identifiers to hit counts. Combining sums the hit counts for matching methods and preserves methods that only appear in one result.

Returns:

  • (Hash)


21
22
23
# File 'lib/simplecov/combine/methods_combiner.rb', line 21

def combine(coverage_a, coverage_b)
  coverage_a.merge(coverage_b) { |_key, a_count, b_count| a_count + b_count }
end