summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--enum.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2097b29397..316280d46f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/enum.c b/enum.c
index a3cb1d7c49..8fc995ee0d 100644
--- a/enum.c
+++ b/enum.c
@@ -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);