summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 09:19:52 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 09:19:52 +0000
commitf5f1a18ceb87cd8ffa065a57b95f6d716ed6902c (patch)
treef5b9f01d28de0c0b38e285a9ad85ad0e9a6eb067 /enum.c
parentfeb1dfdfc6dedfb929e08c4f3aaf21f4983c8b25 (diff)
* enum.c (enum_find, enum_reject): Return an enumerator if no
block is given. * io.c (rb_io_each_line, rb_io_each_byte, rb_io_s_foreach, argf_each_line, argf_each_byte): Ditto. * string.c (str_gsub): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/enum.c b/enum.c
index 7134a6aa84..91da8d758f 100644
--- a/enum.c
+++ b/enum.c
@@ -219,6 +219,7 @@ enum_find(argc, argv, obj)
VALUE if_none;
rb_scan_args(argc, argv, "01", &if_none);
+ RETURN_ENUMERATOR(obj, argc, argv);
rb_iterate(rb_each, obj, find_i, (VALUE)&memo);
if (memo != Qundef) {
return memo;
@@ -366,6 +367,7 @@ enum_reject(obj)
{
VALUE ary = rb_ary_new();
+ RETURN_ENUMERATOR(obj, 0, 0);
rb_iterate(rb_each, obj, reject_i, ary);
return ary;