[#63592] [ruby-trunk - Bug #10009] IO operation is 10x slower in multi-thread environment — normalperson@...
Issue #10009 has been updated by Eric Wong.
3 messages
2014/07/08
[#63682] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/13
[#63703] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/14
[#63743] [ruby-trunk - Bug #10037] Since r46798 on Solaris, "[BUG] rb_vm_get_cref: unreachable" during make — ngotogenome@...
Issue #10037 has been updated by Naohisa Goto.
3 messages
2014/07/15
[#64136] Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb — "Jeffrey 'jf' Lim" <jfs.world@...>
As per subject.
4 messages
2014/07/31
[#64138] Re: Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb
— "Jeffrey 'jf' Lim" <jfs.world@...>
2014/07/31
On Thu, Jul 31, 2014 at 6:03 PM, Jeffrey 'jf' Lim <jfs.world@gmail.com>
[ruby-core:64099] [ruby-trunk - Bug #10013] [CSV] Yielding all elements from a row
From:
dawid.janczak@...
Date:
2014-07-28 14:32:18 UTC
List:
ruby-core #64099
Issue #10013 has been updated by Dawid Janczak.
First of all sorry for the late answer Andrew.
Checking arity was one thing I was considering. You're right that the arity of the block might not match the number of items, but that works fine with arrays.
<code>
foo = [[1, 2], [3, 4]]
foo.each { |el| p el } # => prints [1, 2] then [3, 4]
foo.each { |el1, el2| p el2 } # => prints 2 then 4
foo.each { |el1, el2, el3| p el3 } # => prints nil then nil
</code>
This is basically the same behaviour as parallel assignment with more LVals than RVals.
Another thing I was considering was to always yield CSV::Row objects.
----------------------------------------
Bug #10013: [CSV] Yielding all elements from a row
https://bugs.ruby-lang.org/issues/10013#change-48111
* Author: Dawid Janczak
* Status: Assigned
* Priority: Normal
* Assignee: James Gray
* Category: lib
* Target version: current: 2.2.0
* 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/