mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
faa93e847d
commit
959383cb10
2 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Jun 16 07:14:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/stringio/stringio.c (strio_readline, strio_each)
|
||||
(strio_readlines): set lastline. [ruby-core:17257]
|
||||
|
||||
Mon Jun 16 01:49:39 2008 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* eval.c (rb_f_block_given_p): fix to skip class frame.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue