@@ -489,6 +489,9 @@ enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
489
489
return rb_yield_values (2 , rb_ary_new4 (argc , argv ), idx );
490
490
}
491
491
492
+ static VALUE
493
+ enumerator_size (VALUE obj );
494
+
492
495
/*
493
496
* call-seq:
494
497
* e.with_index(offset = 0) {|(*args), idx| ... }
@@ -507,7 +510,7 @@ enumerator_with_index(int argc, VALUE *argv, VALUE obj)
507
510
VALUE memo ;
508
511
509
512
rb_scan_args (argc , argv , "01" , & memo );
510
- RETURN_ENUMERATOR (obj , argc , argv );
513
+ RETURN_SIZED_ENUMERATOR (obj , argc , argv , enumerator_size );
511
514
memo = NIL_P (memo ) ? 0 : (VALUE )NUM2LONG (memo );
512
515
return enumerator_block_call (obj , enumerator_with_index_i , (VALUE )& memo );
513
516
}
@@ -567,7 +570,7 @@ enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
567
570
static VALUE
568
571
enumerator_with_object (VALUE obj , VALUE memo )
569
572
{
570
- RETURN_ENUMERATOR (obj , 1 , & memo );
573
+ RETURN_SIZED_ENUMERATOR (obj , 1 , & memo , enumerator_size );
571
574
enumerator_block_call (obj , enumerator_with_object_i , memo );
572
575
573
576
return memo ;
0 commit comments