method
to_enum
v1_8_7_72 -
Show latest stable
- Class:
Object
to_enum(...)public
Returns Enumerable::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)
1Note
Needs requiring 'enumerator' to work
This method needs that you
require 'enumerator'
for this method to be available.