[ruby-core:93034] [Ruby trunk Bug#15910] $. doesn't hold the linenumber anymore when reading a CSV-file using the CSV class
From:
ynnor@...
Date:
2019-06-10 11:15:39 UTC
List:
ruby-core #93034
Issue #15910 has been reported by rovf (Ronald Fischer).
----------------------------------------
Bug #15910: $. doesn't hold the linenumber anymore when reading a CSV-file using the CSV class
https://bugs.ruby-lang.org/issues/15910
* Author: rovf (Ronald Fischer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-cygwin]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Example program:
```
require 'csv'
IFS=';'
CSV_OPTIONS = { col_sep: IFS, external_encoding: Encoding::ISO_8859_1, internal_encoding: Encoding::UTF_8 }
CSV.new($stdin, CSV_OPTIONS).each do
|row|
puts "::::line #{$.} row=#{row}"
end%
```
With this program, I could dump a semicolon-delimited CSV file, with line numbers. Now the line number always displays as 0. Has the implementation of CSV changed?
See also https://stackoverflow.com/questions/56524941/is-special-variable-gone-from-ruby
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>