This method is deprecated or moved on the latest stable version.
The last existing version (v1_8_7_330) is shown here.
with_index()
public
Iterates the given block for each elements with an index,
which start from 0. If no block is given, returns an enumerator.
/*
* call-seq:
* e.with_index {|(*args), idx| ... }
* e.with_index
*
* Iterates the given block for each elements with an index, which
* start from 0. If no block is given, returns an enumerator.
*
*/
static VALUE
enumerator_with_index(obj)
VALUE obj;
{
struct enumerator *e = enumerator_ptr(obj);
VALUE memo = 0;
int argc = 0;
VALUE *argv = 0;
RETURN_ENUMERATOR(obj, 0, 0);
if (e->args) {
argc = RARRAY_LEN(e->args);
argv = RARRAY_PTR(e->args);
}
return rb_block_call(e->obj, e->meth, argc, argv,
enumerator_with_index_i, (VALUE)&memo);
}