Class: Reek::Smells::NestedIterators
- Inherits:
-
SmellDetector
- Object
- SmellDetector
- Reek::Smells::NestedIterators
- Defined in:
- lib/reek/smells/nested_iterators.rb
Overview
A Nested Iterator occurs when a block contains another block.
NestedIterators
reports failing methods only once.
Constant Summary
Constants inherited from SmellDetector
SmellDetector::DEFAULT_EXCLUDE_SET, SmellDetector::EXCLUDE_KEY
Class Method Summary collapse
-
.contexts ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#examine_context(block) ⇒ Object
Checks whether the given
block
is inside another.
Methods inherited from SmellDetector
class_name, #configure, #configure_with, #copy, create, default_config, #enabled?, #examine, #exception?, #found, #has_smell?, #initialize, listen, #listen_to, #num_smells, #report_on, #smell_name, #smelly?, #supersede_with, #value
Constructor Details
This class inherits a constructor from Reek::Smells::SmellDetector
Class Method Details
.contexts ⇒ Object
:nodoc:
14 15 16 |
# File 'lib/reek/smells/nested_iterators.rb', line 14 def self.contexts # :nodoc: [:iter] end |
Instance Method Details
#examine_context(block) ⇒ Object
Checks whether the given block
is inside another. Remembers any smells found.
22 23 24 25 |
# File 'lib/reek/smells/nested_iterators.rb', line 22 def examine_context(block) return false unless block.nested_block? found(block, 'is nested') end |