Method: Enumerator::Chain#each
- Defined in:
- enumerator.c
#each(*args) {|...| ... } ⇒ Object #each(*args) ⇒ Object
Iterates over the elements of the first enumerable by calling the “each” method on it with the given arguments, then proceeds to the following enumerables in sequence until all of the enumerables are exhausted.
If no block is given, returns an enumerator.
3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 |
# File 'enumerator.c', line 3284
static VALUE
enum_chain_each(int argc, VALUE *argv, VALUE obj)
{
VALUE enums, block;
struct enum_chain *objptr;
long i;
RETURN_SIZED_ENUMERATOR(obj, argc, argv, argc > 0 ? enum_chain_enum_no_size : enum_chain_enum_size);
objptr = enum_chain_ptr(obj);
enums = objptr->enums;
block = rb_block_proc();
for (i = 0; i < RARRAY_LEN(enums); i++) {
objptr->pos = i;
rb_funcall_with_block(RARRAY_AREF(enums, i), id_each, argc, argv, block);
}
return obj;
}
|