diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-16 07:29:30 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-16 07:29:30 +0000 |
commit | e7bab2a61b4df0463a094211f5501d8e091391a9 (patch) | |
tree | 476c98ed17504bb50e46b387b724c4629f6d80e6 /enum.c | |
parent | 9cd678b72f86ed312321cf04fc83f5a10978485b (diff) | |
download | ruby-e7bab2a61b4df0463a094211f5501d8e091391a9.tar.gz |
* enum.c (enum_each_with_index): each_with_index to forward
arguments to each. [ruby-core:10921]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r-- | enum.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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); |