[#85940] [Ruby trunk Bug#14578] Forking a child process inside of a mutex crashes the ruby interpreter — ben.govero@...
Issue #14578 has been reported by bengovero (Ben Govero).
3 messages
2018/03/05
[#86205] [Ruby trunk Feature#14618] Add display width method to String for CLI — aycabta@...
Issue #14618 has been reported by aycabta (aycabta .).
3 messages
2018/03/19
[#86366] Re: [ruby-cvs:70102] usa:r63008 (trunk): get rid of test error/failure on Windows introduced at r62955 — Eric Wong <normalperson@...>
usa@ruby-lang.org wrote:
3 messages
2018/03/28
[ruby-core:86075] [Ruby trunk Bug#10013][Closed] [CSV] Yielding all elements from a row
From:
kou@...
Date:
2018-03-10 09:02:32 UTC
List:
ruby-core #86075
Issue #10013 has been updated by kou (Kouhei Sutou).
Status changed from Assigned to Closed
Thanks for your report.
I've fixed it at master: https://github.com/ruby/csv/commit/71d66af9824e4a30ed616668fc4ce8d9b68a5026
----------------------------------------
Bug #10013: [CSV] Yielding all elements from a row
https://bugs.ruby-lang.org/issues/10013#change-70938
* Author: Gat (Dawid Janczak)
* Status: Closed
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version:
* ruby -v: ruby 2.2.0dev (2014-07-06 trunk 46722) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
Let's say I have the following CSV file:
col1,col2,col3
1,2,3
4,5,6
(...)
I want to iterate over values yielding them to a block. I can do that like this:
`CSV.foreach('file.csv') { |col1, col2, col3| print col2 + " " } # => "col2 2 5"`
This works fine, but I would like to skip the headers:
`CSV.foreach('file.csv', headers: true) { |col1, col2, col3| print col2 + " " } # => NoMethodError`
CSV yields rows as arrays if headers option is not specified and destructuring works fine.
When headers option is specified however, CSV::Row objects are yielded instead and destructuring fails.
It would be nice to have both scenarios working in the same manner, but I don't know how to approach this. Calling to_a on yielded row (https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L1731) worked, but obviously this would break when people actually expect CSV::Row instance. Any ideas?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>