1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enum.c (enum_take_while): returns Enumerator if no block given.

* enum.c (enum_drop_while): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-11-30 08:15:12 +00:00
parent efedaa432b
commit 58c070aa9b
2 changed files with 8 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Fri Nov 30 16:42:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* enum.c (enum_take_while): returns Enumerator if no block given.
* enum.c (enum_drop_while): ditto.
Thu Nov 29 16:59:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (stmt): remove unnecessary NODE_BEGIN. [ruby-core:13814]

2
enum.c
View file

@ -1451,6 +1451,7 @@ enum_take_while(VALUE obj)
{
VALUE ary;
RETURN_ENUMERATOR(obj, 0, 0);
ary = rb_ary_new();
rb_block_call(obj, id_each, 0, 0, take_while_i, (VALUE)&ary);
return ary;
@ -1522,6 +1523,7 @@ enum_drop_while(VALUE obj)
{
VALUE args[2];
RETURN_ENUMERATOR(obj, 0, 0);
args[0] = rb_ary_new();
args[1] = Qfalse;
rb_block_call(obj, id_each, 0, 0, drop_while_i, (VALUE)args);