Creates a newEnumerable::Enumerator object, which
is to be used as an Enumerable object using
the given object’s given method with the given arguments.
Use of this method is discouraged. Use Kernel#enum_for() instead.
/*
* call-seq:
* Enumerable::Enumerator.new(obj, method = :each, *args)
*
* Creates a new Enumerable::Enumerator object, which is to be
* used as an Enumerable object using the given object's given
* method with the given arguments.
*
* Use of this method is discouraged. Use Kernel#enum_for() instead.
*/
static VALUE
enumerator_initialize(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
VALUE recv, meth = sym_each;
if (argc == 0)
rb_raise(rb_eArgError, "wrong number of argument (0 for 1)");
recv = *argv++;
if (--argc) {
meth = *argv++;
--argc;
}
return enumerator_init(obj, recv, meth, argc, argv);
}