Rewinds the enumerator chain by calling the “rewind” method on each enumerable in reverse order.
Each call is
performed only if the enumerable responds to the method.
static VALUE
enum_chain_rewind(VALUE obj)
{
struct enum_chain *objptr = enum_chain_ptr(obj);
VALUE enums = objptr->enums;
long i;
for (i = objptr->pos; 0 <= i && i < RARRAY_LEN(enums); objptr->pos = --i) {
rb_check_funcall(RARRAY_AREF(enums, i), id_rewind, 0, 0);
}
return obj;
}