mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
merge revision(s) 17352:
* 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/branches/ruby_1_8_7@17660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9ba0dcb904
commit
40303dfb05
3 changed files with 9 additions and 2 deletions
|
@ -990,7 +990,7 @@ strio_readline(argc, argv, self)
|
|||
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;
|
||||
}
|
||||
|
@ -1014,6 +1014,7 @@ strio_each(argc, argv, 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;
|
||||
|
@ -1036,6 +1037,7 @@ strio_readlines(argc, argv, 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
Add a link
Reference in a new issue