summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 22:14:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 22:14:51 +0000
commit959383cb10a0e0bda3352fd426aa1c91b2ebafc4 (patch)
treecfda3c4aacb7dd02fcbae42b0d88ead0fd7ad6c9 /ext
parentfaa93e847da75c0b8f5bae70f8362f22865388a6 (diff)
* ext/stringio/stringio.c (strio_readline, strio_each)
(strio_readlines): set lastline. [ruby-core:17257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/stringio/stringio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 8b5abb3f62..d140ced7e7 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -928,7 +928,7 @@ strio_gets(int argc, VALUE *argv, VALUE self)
static VALUE
strio_readline(int argc, VALUE *argv, VALUE self)
{
- VALUE line = strio_getline(argc, argv, readable(StringIO(self)));
+ VALUE line = strio_gets(argc, argv, self);
if (NIL_P(line)) rb_eof_error();
return line;
}
@@ -953,6 +953,7 @@ strio_each(int argc, VALUE *argv, VALUE self)
RETURN_ENUMERATOR(self, argc, argv);
while (!NIL_P(line = strio_getline(argc, argv, readable(ptr)))) {
+ rb_lastline_set(line);
rb_yield(line);
}
return self;
@@ -974,6 +975,7 @@ strio_readlines(int argc, VALUE *argv, VALUE self)
while (!NIL_P(line = strio_getline(argc, argv, readable(ptr)))) {
rb_ary_push(ary, line);
}
+ rb_lastline_set(Qnil);
return ary;
}