mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
9cd678b72f
commit
e7bab2a61b
2 changed files with 9 additions and 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.
|
||||
|
|
8
enum.c
8
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);
|
||||
|
|
Loading…
Reference in a new issue