Module: SimpleCov::Combine::FilesCombiner

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

Overview

Handle combining two coverage results for same file

Should be called through ‘SimpleCov.combine`.

Class Method Summary collapse

Class Method Details

.combine(coverage_a, coverage_b) ⇒ Hash

Combines the results for 2 coverages of a file.

Returns:

  • (Hash)


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/simplecov/combine/files_combiner.rb', line 17

def combine(coverage_a, coverage_b)
  combination = {"lines" => Combine.combine(LinesCombiner, coverage_a["lines"], coverage_b["lines"])}
  if SimpleCov.branch_coverage?
    combined_branches = Combine.combine(BranchesCombiner, coverage_a["branches"], coverage_b["branches"])
    combination["branches"] = combined_branches || {}
  end
  if SimpleCov.method_coverage?
    combination["methods"] = Combine.combine(MethodsCombiner, coverage_a["methods"], coverage_b["methods"])
  end
  combination
end