Sha256: 64980e303882940f469de37829f4afdf46ec7b8a9cde75542789e6a4e482ae6d

Contents?: true

Size: 832 Bytes

Versions: 6

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

module Reek
  module SmellDetectors
    module ControlParameterHelpers
      #
      # Collects information about a single control parameter.
      #
      class Candidate
        #
        # @param parameter [Symbol] the parameter name
        # @param occurrences [Array<Reek::AST::Node>] the occurrences of the ControlParameter smell
        #   e.g. [s(:lvar, :bravo), s(:lvar, :bravo)]
        #
        def initialize(parameter, occurrences)
          @parameter = parameter
          @occurrences = occurrences
        end

        def smells?
          occurrences.any?
        end

        def lines
          occurrences.map(&:line)
        end

        def name
          parameter.to_s
        end

        private

        attr_reader :occurrences, :parameter
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reek-6.4.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.3.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.2.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.1.4 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.1.3 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.1.2 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb