Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't parse a single new line character #53

Closed
cbeer opened this issue Dec 14, 2018 · 1 comment
Closed

Can't parse a single new line character #53

cbeer opened this issue Dec 14, 2018 · 1 comment

Comments

@cbeer
Copy link

cbeer commented Dec 14, 2018

$ ruby -r csv -e 'puts CSV::VERSION'
3.0.1
$ ruby -v
ruby 2.6.0rc1 (2018-12-06 trunk 66253) [x86_64-darwin18]

This seems to be a recent regression.

In Ruby 2.6:

> CSV.parse("\n", {headers:'s'}) { |x| puts x }
Traceback (most recent call last):
       11: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/bin/irb:23:in `<main>'
       10: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/bin/irb:23:in `load'
        9: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/gems/2.6.0/gems/irb-0.9.6/exe/irb:11:in `<top (required)>'
        8: from (irb):5
        7: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/2.6.0/csv.rb:693:in `parse'
        6: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/2.6.0/csv.rb:1147:in `each'
        5: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/2.6.0/csv.rb:1205:in `shift'
        4: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/2.6.0/csv.rb:1205:in `loop'
        3: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/2.6.0/csv.rb:1239:in `block in shift'
        2: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/2.6.0/csv.rb:1239:in `new'
        1: from /Users/cabeer/.rubies/ruby-2.6.0-rc1/lib/ruby/2.6.0/csv/row.rb:32:in `initialize'
NoMethodError (undefined method `each' for nil:NilClass)

In Ruby 2.5:

CSV.parse("\n", {headers:'s'}) { |x| puts x }

=> nil
kou added a commit that referenced this issue Dec 14, 2018
GitHub: #53

Reported by Chris Beer. Thanks!!!
@kou
Copy link
Member

kou commented Dec 14, 2018

Thanks for your report.
I've fixed this.

@kou kou closed this as completed Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants