From: "ufuk (Ufuk Kayserilioglu)" Date: 2022-07-15T17:51:54+00:00 Subject: [ruby-core:109223] [Ruby master Bug#18909] ARGF.readlines reads more than current file Issue #18909 has been updated by ufuk (Ufuk Kayserilioglu). JohanJosefsson (Johan Josefsson) wrote in #note-7: > Yes, ARGF can work with a concatenated pseudo file in several ways but this idea collides squarely with the idea of inplace editing (-i option). Kernel.readlines already makes an array from the concatenated file. Therefore I think a method that only reads the current file an thereby can keep the inplace sematics would be useful. It is not the case that `ARGF` _can_ work with a concatenated stream, it **does** work with a concatenated stream of all the files in `ARGV`, which you can control by modifying `ARGV`, btw. It is true that this is problematic with the `-i` option, but you are asking to change the existing behaviour of a documented API. That should be a feature request at best, but is certainly not a bug. ---------------------------------------- Bug #18909: ARGF.readlines reads more than current file https://bugs.ruby-lang.org/issues/18909#change-98360 * 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: