Class: DeepCover::Analyser::CoveredCodeSource

Inherits:
DeepCover::Analyser show all
Defined in:
lib/deep_cover/analyser/covered_code_source.rb

Instance Attribute Summary collapse

Attributes included from Base

#options, #source

Instance Method Summary collapse

Methods included from Base

#each_node, #node_covered?, #node_runs_map, #node_stat_contributions, #node_stat_type, #results, #stats

Methods included from Tools::Covered

#covered?

Constructor Details

#initialize(covered_code) ⇒ CoveredCodeSource

Returns a new instance of CoveredCodeSource.



7
8
9
# File 'lib/deep_cover/analyser/covered_code_source.rb', line 7

def initialize(covered_code)
  @covered_code = covered_code.freeze
end

Instance Attribute Details

#covered_codeObject (readonly)

Returns the value of attribute covered_code.



5
6
7
# File 'lib/deep_cover/analyser/covered_code_source.rb', line 5

def covered_code
  @covered_code
end

Instance Method Details

#node_children(node) ⇒ Object

Looking exclusively at our subset of nodes, returns the node’s direct descendants



12
13
14
# File 'lib/deep_cover/analyser/covered_code_source.rb', line 12

def node_children(node)
  node.children_nodes
end

#node_runs(node) ⇒ Object

Returns the number of runs of the node (assumed to be in our subset)



17
18
19
# File 'lib/deep_cover/analyser/covered_code_source.rb', line 17

def node_runs(node)
  node.execution_count if node.executable?
end