Ruby LanguageEnumerators


Introduction

An Enumerator is an object that implements iteration in a controlled fashion.

Instead of looping until some condition is satisfied, the object enumerates values as needed. Execution of the loop is paused until the next value is requested by the owner of the object.

Enumerators make infinite streams of values possible.

Parameters

ParameterDetails
yieldResponds to yield, which is aliased as <<. Yielding to this object implements iteration.