Module: DeepCover::Analyser::IgnoreUncovered

Included in:
DeepCover::Analyser
Defined in:
lib/deep_cover/analyser/ignore_uncovered.rb

Instance Method Summary collapse

Instance Method Details

#initialize(source, ignore_uncovered: [], **options) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/deep_cover/analyser/ignore_uncovered.rb', line 5

def initialize(source, ignore_uncovered: [], **options)
  super
  @allow_filters = Array(ignore_uncovered)
                   .map { |kind| :"is_#{kind}?" }
                   .select { |name| respond_to?(name) }
                   .map { |name| method(name) } # So was tempted to write `.map(&method(:method))`!
end

#node_runs(node) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/deep_cover/analyser/ignore_uncovered.rb', line 13

def node_runs(node)
  runs = super
  if runs == 0 && @allow_filters.any? { |f| f[node] }
    runs = nil
  end
  runs
end