Class: Reek::Smells::ControlParameter::ControlParameterFinder Private
- Inherits:
-
Object
- Object
- Reek::Smells::ControlParameter::ControlParameterFinder
- Defined in:
- lib/reek/smells/control_parameter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Finds cases of ControlParameter in a particular node for a particular parameter
Constant Summary collapse
- CONDITIONAL_NODE_TYPES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[:if, :case, :and, :or]
Instance Method Summary collapse
- #find_matches ⇒ Object private
-
#initialize(node, param) ⇒ ControlParameterFinder
constructor
private
A new instance of ControlParameterFinder.
- #legitimite_uses? ⇒ Boolean private
Constructor Details
#initialize(node, param) ⇒ ControlParameterFinder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ControlParameterFinder.
92 93 94 95 |
# File 'lib/reek/smells/control_parameter.rb', line 92 def initialize(node, param) @node = node @param = param end |
Instance Method Details
#find_matches ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
97 98 99 100 |
# File 'lib/reek/smells/control_parameter.rb', line 97 def find_matches return [] if legitimite_uses? nested_finders.flat_map(&:find_matches) + uses_of_param_in_condition end |
#legitimite_uses? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
102 103 104 105 106 107 |
# File 'lib/reek/smells/control_parameter.rb', line 102 def legitimite_uses? return true if uses_param_in_body? return true if uses_param_in_call_in_condition? return true if nested_finders.any?(&:legitimite_uses?) false end |