A Nested Iterator occurs when a block contains another block.
Example
Given
classDuck
class<<self
defduck_names
%i!tick trick track!.eachdo|surname|
%i!duck!.eachdo|last_name|
puts "full name is #{surname}#{last_name}"
end
end
end
end
end
Reek would report the following warning:
test.rb -- 1 warning:
[5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)
Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.