Actions
Bug #13051
closedObject created with ARGF.class.new fails to update .lineno in .each
Bug #13051:
Object created with ARGF.class.new fails to update .lineno in .each
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0rc1 (2016-12-12 trunk 57064) [i686-linux]
Description
I don't know if this way of creating ARGF-like objects is supported or not.
I just noticed that it didn't update the .lineno when used in .each.
Consider the example input file:
The following code:
Outputs this:
I was expecting this:
If, instead of using .each, I read it in 2 steps with: while line = f.gets; puts f.lineno; ..., then it works, the line numbers are updated.
Updated by nobu (Nobuyoshi Nakada) over 9 years ago
- Status changed from Open to Closed
Applied in changeset r57124.
io.c: update argf lineno
- io.c (argf_block_call_line): update line number in non-global
ARGF instance. [ruby-core:78728] [Bug #13051]
Actions