Issue #1687 has been updated by Run Paint Run Run.
Nobu, thanks for looking.
Using the .lines iterator, ARGF.lineno returns the correct line number:
$ cat argf.rb
ARGF.lines { |l| p ARGF.lineno }
$ echo -e "foo\nbar\nglark" >file
$ ruby argf.rb file
1
2
3
Using the .chars iterator, it always returns 0:
$ cat argf.rb
ARGF.chars { |c| p ARGF.lineno }
$ ruby argf.rb file
0
0
...
0
0
Using .bytes has the same result:
$ cat argf.rb
ARGF.bytes { |b| p ARGF.lineno }
$ ruby argf.rb file
0
0
...
0
0
On 1.8, the last two examples always print 1.
Am I missing something obvious here? :-)
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1687
----------------------------------------
http://redmine.ruby-lang.org