diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | enum.c | 8 |
2 files changed, 9 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Mon Apr 16 10:51:37 2007 Yukihiro Matsumoto <matz@ruby-lang.org> + + * enum.c (enum_each_with_index): each_with_index to forward + arguments to each. [ruby-core:10921] + Mon Apr 16 10:43:10 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * time.c (time_arg): should allow to specify 24:00. @@ -1144,14 +1144,14 @@ each_with_index_i(VALUE val, VALUE memo) */ static VALUE -enum_each_with_index(VALUE obj) +enum_each_with_index(int argc, VALUE *argv, VALUE obj) { VALUE memo; - RETURN_ENUMERATOR(obj, 0, 0); + RETURN_ENUMERATOR(obj, argc, argv); memo = rb_ary_new3(2, Qnil, INT2FIX(0)); - rb_block_call(obj, id_each, 0, 0, each_with_index_i, memo); + rb_block_call(obj, id_each, argc, argv, each_with_index_i, memo); return obj; } @@ -1379,7 +1379,7 @@ Init_Enumerable(void) rb_define_method(rb_mEnumerable,"max_by", enum_max_by, 0); rb_define_method(rb_mEnumerable,"member?", enum_member, 1); rb_define_method(rb_mEnumerable,"include?", enum_member, 1); - rb_define_method(rb_mEnumerable,"each_with_index", enum_each_with_index, 0); + rb_define_method(rb_mEnumerable,"each_with_index", enum_each_with_index, -1); rb_define_method(rb_mEnumerable, "zip", enum_zip, -1); rb_define_method(rb_mEnumerable, "take", enum_take, -1); rb_define_method(rb_mEnumerable, "drop", enum_drop, -1); |