Class: DeepCover::Coverage::Analysis

Inherits:
Struct
  • Object
show all
Includes:
Memoize
Defined in:
lib/deep_cover/coverage/analysis.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Memoize

#freeze, included

Instance Attribute Details

#covered_codesObject

Returns the value of attribute covered_codes

Returns:

  • (Object)

    the current value of covered_codes



5
6
7
# File 'lib/deep_cover/coverage/analysis.rb', line 5

def covered_codes
  @covered_codes
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



5
6
7
# File 'lib/deep_cover/coverage/analysis.rb', line 5

def options
  @options
end

Class Method Details

.templateObject



25
26
27
# File 'lib/deep_cover/coverage/analysis.rb', line 25

def self.template
  {node: Analyser::Node, per_char: Analyser::PerChar, branch: Analyser::Branch}
end

Instance Method Details

#analyser_mapObject



9
10
11
12
13
# File 'lib/deep_cover/coverage/analysis.rb', line 9

def analyser_map
  covered_codes.map do |covered_code|
    [covered_code, compute_analysers(covered_code)]
  end.to_h
end

#overallObject



19
20
21
22
23
# File 'lib/deep_cover/coverage/analysis.rb', line 19

def overall
  return 100 if stat_map.empty?
  node, branch = Tools.merge(*stat_map.values, :+).values_at(:node, :branch)
  (node + branch).percent_covered
end

#stat_mapObject



15
16
17
# File 'lib/deep_cover/coverage/analysis.rb', line 15

def stat_map
  analyser_map.transform_values { |a| a.transform_values(&:stats) }
end