Module: SimpleCov::Combine

Defined in:
lib/simplecov/combine.rb,
lib/simplecov/combine/files_combiner.rb,
lib/simplecov/combine/lines_combiner.rb,
lib/simplecov/combine/results_combiner.rb,
lib/simplecov/combine/branches_combiner.rb

Overview

Functionally for combining coverage results

Defined Under Namespace

Modules: BranchesCombiner, FilesCombiner, LinesCombiner, ResultsCombiner

Class Method Summary collapse

Class Method Details

.combine(combiner_module, coverage_a, coverage_b) ⇒ Hash

Combine two coverage based on the given combiner_module.

Combiners should always be called through this interface, as it takes care of short-circuiting of one of the coverages is nil.

Returns:

  • (Hash)


16
17
18
19
20
# File 'lib/simplecov/combine.rb', line 16

def combine(combiner_module, coverage_a, coverage_b)
  return existing_coverage(coverage_a, coverage_b) if empty_coverage?(coverage_a, coverage_b)

  combiner_module.combine(coverage_a, coverage_b)
end

.empty_coverage?(coverage_a, coverage_b) ⇒ Boolean

Returns:

  • (Boolean)


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

def empty_coverage?(coverage_a, coverage_b)
  !(coverage_a && coverage_b)
end

.existing_coverage(coverage_a, coverage_b) ⇒ Object



26
27
28
# File 'lib/simplecov/combine.rb', line 26

def existing_coverage(coverage_a, coverage_b)
  coverage_a || coverage_b
end