Project

General

Profile

Bug #15823

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

The documentation for `ARGF.each` ARGF.each at http://ruby-doc.org/core-2.6.3/ARGF.html#method-i-each 
 describes `ARGF.lineno` ARGF.lineno as if it behaved like `ARGF.file.lineno`, ARGF.file.lineno, when it behaves for me like `$.` $. 

 Here's the sample code from the documentation: 

 ```ruby 
 ARGF.each_line do |line| 
   puts ARGF.filename if ARGF.lineno == 1 
   puts "#{ARGF.lineno}: #{line}" 
 end 
 ``` 

 A shell one-liner demonstration: 

 ``` 
 for i in a b; do echo $i>$i; done; ruby -e 'ARGF.each_line do print " #{ARGF.filename} #{ARGF.lineno}"; end; puts' a b 
  a 1 b 2 
 ``` 

 The documents indicate that should be a 1 b 1' 

 Are the documents correct or the implementation?

Back