Actions
Bug #15823
closedARGF.lineno behavior and documentation disagree
    Bug #15823:
    ARGF.lineno behavior and documentation disagree
  
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
Backport:
Description
The documentation for ARGF.each at http://ruby-doc.org/core-2.6.3/ARGF.html#method-i-each
describes ARGF.lineno as if it behaved like ARGF.file.lineno, when it behaves for me like $.
Here's the sample code from the documentation:
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?
        
          
          Updated by nobu (Nobuyoshi Nakada) over 6 years ago
          
          
        
        
      
      - Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED
 
Thank you, that document is wrong.
        
          
          Updated by nobu (Nobuyoshi Nakada) over 6 years ago
          
          
        
        
      
      - Description updated (diff)
 
        
          
          Updated by nobu (Nobuyoshi Nakada) over 6 years ago
          
          
        
        
      
      - Status changed from Open to Closed
 
Applied in changeset git|374c8f4ebab1a740990330c732b9de965c5e8d10.
Fixed about ARGF.lineno
[Bug #15823]
        
          
          Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago
          
          
        
        
      
      - Backport changed from 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: REQUIRED, 2.5: REQUIRED, 2.6: DONE
 
ruby_2_6 r67719 merged revision(s) 374c8f4ebab1a740990330c732b9de965c5e8d10.
        
          
          Updated by usa (Usaku NAKAMURA) over 6 years ago
          
          
        
        
      
      - Backport changed from 2.4: REQUIRED, 2.5: REQUIRED, 2.6: DONE to 2.4: REQUIRED, 2.5: DONE, 2.6: DONE
 
ruby_2_5 r67722 merged revision(s) 374c8f4ebab1a740990330c732b9de965c5e8d10.
Actions