Sha256: a3c97216c2d19be5e9674b38f97939ff48187e745ed5a95f5c27edd28abfadd6

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

# Nested Iterators

## Introduction

A `Nested Iterator` occurs when a block contains another block.

## Example

Given

```Ruby
class Duck
  class << self
    def duck_names
      %i!tick trick track!.each do |surname|
        %i!duck!.each do |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)
```

## Current Support in Reek

Nested Iterators reports failing methods only once.
`Object#tap` is ignored by default and thus does not count as iterator.

## Configuration

`Nested Iterators` offers the [Basic Smell Options](Basic-Smell-Options.md).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reek-3.3.1 docs/Nested-Iterators.md