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)
static VALUE obj_to_enum(obj, enum_args) VALUE obj, enum_args; { rb_ary_unshift(enum_args, obj); return rb_apply(rb_cEnumerator, id_new, enum_args); }
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)
static VALUE obj_to_enum(obj, enum_args) VALUE obj, enum_args; { rb_ary_unshift(enum_args, obj); return rb_apply(rb_cEnumerator, id_new, enum_args); }