From: Mike Kasick Date: 2009-07-24T11:10:32+09:00 Subject: ARGF.eof? behavior Hi folks, In Ruby 1.8, I know that: $ ruby -e 'while !ARGF.eof?; puts ARGF.readline; end' /tmp/foo /tmp/bar prints every line in /tmp/foo, but not /tmp/bar. However, in Ruby 1.9: $ ruby1.9 -e 'p ARGF.eof?' /tmp/foo true Which means that lines from neither /tmp/foo nor /tmp/bar would be printed in the first example. Is this an expected change in behavior? Seems to be consistent for both 1.9.1p0 and the 1.9.2 svn trunk I just compiled. If it is, it's not that big of a deal, except I'm not sure how to "switch ARGF" to the next file without calling ARGF.gets or ARGF.readline. For example, is there a method to complete the following code, so as to print lines from all files listed in ARGV? while !ARGV.empty? # ARGF.some_method_to_advance_to_next_file while !ARGF.eof? puts ARGF.readline end end I know I can use ARGF.each, gets, or readline. However, I'm really calling a parsing method that takes ARGF as an argument and calls readline on my behalf. I'd like to able to distinguish between EOFErrors due to reaching EOF before parsing (no more data records), and EOFErrors due to reaching EOF during parsing (an incomplete data record). Thanks!