method
to_enum

to_enum(*args)
public
Returns Enumerator.new(self, method, *args).
e.g.:
str = "xyz" enum = str.enum_for(:each_byte) a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"] # protects an array from being modified a = [1, 2, 3] some_method(a.to_enum)