[#109207] [Ruby master Feature#18915] New error class: NotImplementedYetError or scope change for NotImplementedYet — Quintasan <noreply@...>
Issue #18915 has been reported by Quintasan (Michał Zając).
18 messages
2022/07/14
[ruby-core:109243] [Ruby master Bug#18909] ARGF.readlines reads more than current file
From:
"mame (Yusuke Endoh)" <noreply@...>
Date:
2022-07-19 09:28:01 UTC
List:
ruby-core #109243
Issue #18909 has been updated by mame (Yusuke Endoh).
Is this what you want?
```
$ echo primo > a
$ echo secundo >> a
$ echo PRIMO > b
$ ruby -i.bak -e 'until ARGF.closed?; x = ARGF.file.readlines; puts "#{ x.size } lines"; puts x; ARGF.skip; end' a b
$ cat a
2 lines
primo
secundo
$ cat b
1 lines
PRIMO
```
TBH I don't recommend to use `-i` either
----------------------------------------
Bug #18909: ARGF.readlines reads more than current file
https://bugs.ruby-lang.org/issues/18909#change-98377
* Author: JohanJosefsson (Johan Josefsson)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
* Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED
----------------------------------------
The docuentation says that ARGF.readlines: *Reads ARGF's current file in its entirety* , but this is what happens:
`$ cat fileA
A
$ cat fileB
B
$ ruby -e 'puts ARGF.readlines' fileA fileB
A
B`
i.e. it reads both the current file and the next one (all files?).
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>