If an iteration method such as each
is called without a block, an [Enumerator](<http://ruby-doc.org/core/Enumerator.html>)
should be returned.
This can be done using the [enum_for](<http://ruby-doc.org/core/Object.html#method-i-enum_for>)
method:
def each
return enum_for :each unless block_given?
yield :x
yield :y
yield :z
end
This enables the programmer to compose [Enumerable](<http://ruby-doc.org/core/Enumerable.html>)
operations:
each.drop(2).map(&:upcase).first
# => :Z