summaryrefslogtreecommitdiff
path: root/ext/stringio
diff options
context:
space:
mode:
authorsorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-09 14:28:06 +0000
committersorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-09 14:28:06 +0000
commit4e817b39b42fb1089ed0d4eb5f8c4d3e0e695960 (patch)
treeeb03ce997a98639257308ecf23237fd70db666ad /ext/stringio
parent0a69f2e39de67d3d9887673b5030adcc5f2d0b81 (diff)
* ext/stringio/stringio.c (strio_each):
Fix exception message and don't raise immediately if block is not given. Fixes [ruby-dev:43394]. * test/stringio/test_stringio.rb (test_each_line_limit_0): Fix test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r--ext/stringio/stringio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 609355a..1bb5e0f 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -1067,13 +1067,13 @@ strio_each(int argc, VALUE *argv, VALUE self)
struct StringIO *ptr = StringIO(self);
VALUE line;
+ RETURN_ENUMERATOR(self, argc, argv);
+
if(argc > 0 && TYPE(argv[argc-1]) == T_FIXNUM &&
FIX2INT(argv[argc-1]) == 0) {
- rb_raise(rb_eArgError, "invalid limit: 0 for readlines");
+ rb_raise(rb_eArgError, "invalid limit: 0 for each_line");
}
- RETURN_ENUMERATOR(self, argc, argv);
-
while (!NIL_P(line = strio_getline(argc, argv, readable(ptr)))) {
rb_yield(line);
}