"enumerable" refers to an ordering scheme that enables items in a set, sequence or collection to be readily addressed or traversed.
Enumerable
is a Ruby module which can be included in other Ruby classes in order to allow iteration via #map
/#collect
, #select
, #each
, and so on.
Enumerable
also manifests as the class Enumerator
(documentation), which is returned when an iteration method is called without a block (e.g., array.each
instead of array.each { |x| puts x }
).
Enumerable objects may also utilize chained iteration, e.g., array.each.with_indices
instead of array.each_with_indices
.
Ruby 2.0 also introduces the concept of lazy enumeration.
In .NET, Enumerable
is the class that wraps most common LINQ extension methods.