[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>
Currently, ruby/spec is maintained mostly by individuals and enjoys the
13 messages
2016/12/13
[#78963] Re: ruby/spec needs help from CRuby committers
— Urabe Shyouhei <shyouhei@...>
2017/01/04
I did ask attendees of last developer meeting to join this
[#78642] Re: ruby/spec needs help from CRuby committers
— Eric Wong <normalperson@...>
2016/12/14
Benoit Daloze <eregontp@gmail.com> wrote:
[ruby-core:78781] [Ruby trunk Feature#12839] CSV - Give not nil but empty strings for empty fields
From:
shyouhei@...
Date:
2016-12-21 14:30:20 UTC
List:
ruby-core #78781
Issue #12839 has been updated by Shyouhei Urabe.
Assignee set to James Gray
Currently no active developers are there for CSV.
I heard the distinguish between silent and sound empty cells are intentional. However I have no idea if converter issue is a bug or design.
----------------------------------------
Feature #12839: CSV - Give not nil but empty strings for empty fields
https://bugs.ruby-lang.org/issues/12839#change-62185
* Author: 5 5
* Status: Open
* Priority: Normal
* Assignee: James Gray
* Target version:
----------------------------------------
The CSV parser gives nil for empty fields.
```rb
require "csv"
CSV.parse(%|,""|) #=> [[nil, ""]]
```
The above behavior maybe be suitable for certain programmers, but I hope to get `[["", ""]]`.
So I had used to write the following code reluctantly till Ruby 2.1:
```rb
require "csv"
CSV.parse(%|,""|, converters: lambda{|v| v || ""})
#=> [["", ""]]
```
It is wasteful, but certainly works for my purpose.
However, because of #11126, the above code does not work from Ruby 2.2.
(Converters are not called for nil)
I merely want an option, which makes the CSV parser give empty strings for empty fields.
Namely,
```rb
require "csv"
CSV.parse(%|,""|, string: true) #=> [["", ""]]
```
--
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>