Enumerator

class Enumerator

Parent:
Object
Included modules:
Enumerable

A class which allows both internal and external iteration.

An Enumerator can be created by the following methods.

  • Kernel#to_enum

  • Kernel#enum_for

  • ::new

Most methods have two forms: a block form where the contents are evaluated for each item in the enumeration, and a non-block form which returns a new Enumerator wrapping the iteration.

enumerator = %w(one two three).each
put