Project

General

Profile

Actions

Bug #10246

closed

CSV.parse(csv_string, headers: col_headers) reports undefined method `table'

Bug #10246: CSV.parse(csv_string, headers: col_headers) reports undefined method `table'

Added by railsonmaui (Justin Gordon) about 11 years ago. Updated about 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.1.2
[ruby-core:65060]

Description

I've detailed repro steps here: http://railsonmaui-octopress.dev/blog/2014/09/15/pry-ruby-array-zip-csv-and-the-hash-constructor/

[12] (pry) main: 0> csv = CSV.parse(csv_string, headers: col_headers)
(pry) output error: #<NoMethodError: undefined method `table' for #<Object:0x007fdbfc8d5588>>

The CSV docs clearly state that the initialize method takes an option :headers

Updated by nobu (Nobuyoshi Nakada) about 11 years ago Actions #1 [ruby-core:65061]

  • Description updated (diff)

Justin Gordon wrote:

I've detailed repro steps here: http://railsonmaui-octopress.dev/blog/2014/09/15/pry-ruby-array-zip-csv-and-the-hash-constructor/

I can't access that site, can anybody show the content?

Updated by avit (Andrew Vit) about 11 years ago Actions #2 [ruby-core:65064]

Aloha Justin,

Looks like the correct URL is here:
http://www.railsonmaui.com/blog/2014/09/15/pry-ruby-array-zip-csv-and-the-hash-constructor/

The CSV headers option is working, I use it myself all the time. Is the problem that you're trying to parse an invalid CSV string? That's what it looks like in your blog post because you use it again further down after fixing the input and it's fine.

Updated by hsbt (Hiroshi SHIBATA) about 11 years ago Actions #3 [ruby-core:65654]

  • Status changed from Open to Feedback

Updated by jeremyevans0 (Jeremy Evans) about 6 years ago Actions #4

  • Status changed from Feedback to Closed
Actions

Also available in: PDF Atom