Class: Reek::SmellDetectors::ControlParameterHelpers::Candidate
- Inherits:
-
Object
- Object
- Reek::SmellDetectors::ControlParameterHelpers::Candidate
- Defined in:
- lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
Overview
Collects information about a single control parameter.
Instance Attribute Summary collapse
-
#occurrences ⇒ Object
readonly
private
Returns the value of attribute occurrences.
-
#parameter ⇒ Object
readonly
private
Returns the value of attribute parameter.
Instance Method Summary collapse
-
#initialize(parameter, occurrences) ⇒ Candidate
constructor
A new instance of Candidate.
- #lines ⇒ Object
- #name ⇒ Object
- #smells? ⇒ Boolean
Constructor Details
#initialize(parameter, occurrences) ⇒ Candidate
Returns a new instance of Candidate.
15 16 17 18 |
# File 'lib/reek/smell_detectors/control_parameter_helpers/candidate.rb', line 15 def initialize(parameter, occurrences) @parameter = parameter @occurrences = occurrences end |
Instance Attribute Details
#occurrences ⇒ Object (readonly, private)
Returns the value of attribute occurrences.
34 35 36 |
# File 'lib/reek/smell_detectors/control_parameter_helpers/candidate.rb', line 34 def occurrences @occurrences end |
#parameter ⇒ Object (readonly, private)
Returns the value of attribute parameter.
34 35 36 |
# File 'lib/reek/smell_detectors/control_parameter_helpers/candidate.rb', line 34 def parameter @parameter end |
Instance Method Details
#lines ⇒ Object
24 25 26 |
# File 'lib/reek/smell_detectors/control_parameter_helpers/candidate.rb', line 24 def lines occurrences.map(&:line) end |
#name ⇒ Object
28 29 30 |
# File 'lib/reek/smell_detectors/control_parameter_helpers/candidate.rb', line 28 def name parameter.to_s end |
#smells? ⇒ Boolean
20 21 22 |
# File 'lib/reek/smell_detectors/control_parameter_helpers/candidate.rb', line 20 def smells? occurrences.any? end |