Class: Coco::CoverageResult

Inherits:
Object
  • Object
show all
Defined in:
lib/coco/cover/coverage_result.rb

Overview

Compute results of interest from the big results information (from Coverage.result)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, raw_results) ⇒ CoverageResult

Public: Initialize a CoverageResult.

config - Hash raw_results - Hash results obtained from Coverage.result.

Raises:

  • (ArgumentError)

23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/coco/cover/coverage_result.rb', line 23

def initialize(config, raw_results)
  @exclude_files = config[:excludes]
  @threshold = config[:threshold]
  raise ArgumentError if @threshold < 0
  @result = raw_results
  exclude_external_sources
  exclude_files_user_dont_want
  if config[:exclude_above_threshold]
    @covered_from_domain = exclude_sources_above_threshold
  else
    @covered_from_domain = @all_from_domain
  end
end

Instance Attribute Details

#all_from_domainObject (readonly)

Returns a Hash coverage for all the sources that live in the root project folder.


11
12
13
# File 'lib/coco/cover/coverage_result.rb', line 11

def all_from_domain
  @all_from_domain
end

#covered_from_domainObject (readonly)

Returns a Hash coverage for sources that are not sufficiently covered. More technically, the sources that live in the root project folder and for which the coverage percentage is under the threshold.


17
18
19
# File 'lib/coco/cover/coverage_result.rb', line 17

def covered_from_domain
  @covered_from_domain
end