Class: DeepCover::Analyser::PerLine
- Inherits:
-
DeepCover::Analyser
- Object
- DeepCover::Analyser
- DeepCover::Analyser::PerLine
- Defined in:
- lib/deep_cover/analyser/per_line.rb
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
-
#results ⇒ Object
Returns an array of runs, one per line.
Methods included from OptionallyCovered
Methods included from IgnoreUncovered
Methods included from Base
#covered_code, #each_node, #initialize, #node_children, #node_runs, #node_runs_map
Instance Method Details
#results ⇒ Object
Returns an array of runs, one per line.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/deep_cover/analyser/per_line.rb', line 6 def results disallow_partial = !.fetch(:allow_partial, true) line_hits = Array.new(covered_code.nb_lines + covered_code.lineno - 1) each_node do |node| next unless (runs = node_runs(node)) node.executed_locs.each do |loc| lineno = loc.line - 1 if disallow_partial line_hits[lineno] = 0 if runs == 0 next if line_hits[lineno] == 0 end line_hits[lineno] = [line_hits[lineno] || 0, runs].max end end line_hits end |