Sha256: 43c003d8712fbd3e34a515ec1921d8e5c63ec870cf5b39af2dc9287d22301bf1

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

module Reek
  class DetectorStack

    def initialize(default_detector)
      @detectors = [default_detector]
    end

    def push(config)
      clone = @detectors[0].copy
      clone.configure_with(config)
      @detectors.each {|det| det.be_masked}
      @detectors << clone
    end

    def listen_to(hooks)
      @detectors.each { |det| det.listen_to(hooks) }
    end

    def report_on(report)
      @detectors.each { |det| det.report_on(report) }
    end

    def num_smells
      total = 0
      @detectors.each { |det| total += det.num_smells }
      total
    end

    def has_smell?(patterns)
      @detectors.each { |det| return true if det.has_smell?(patterns) }
      false
    end

    def smelly?
      # SMELL: Duplication: look at al those loops!
      @detectors.each { |det| return true if det.smelly? }
      false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kevinrutherford-reek-1.1.3.11 lib/reek/detector_stack.rb
kevinrutherford-reek-1.1.3.12 lib/reek/detector_stack.rb
kevinrutherford-reek-1.1.3.13 lib/reek/detector_stack.rb