Skip to content

Header refreshing problem of CSV::Table in v 3.0.3  #71

Closed
@tkosaka1976

Description

@tkosaka1976

Probably, v3.0.3, the header of CSV::Table is not refreshed by the addition of new CSV::Row object or Hash.

require 'csv'

txt =<<TXT
"h1","h2","h3"
1,"test",3
2,"test",6
3,"test",9
TXT

table = CSV::parse(txt, headers: true)
table.each do |row|
  row << {"h4" => "additional"}
end
puts table.to_csv

ver 3.0.3

h1,h2,h3
1,test,3,additional
2,test,6,additional
3,test,9,additional

ver 3.0.0

h1, h2, h3, h4
1, test, 3, additional
2, test, 6, additional
3, test, 9, additional

I'm not sure but from discussion in stack-overflow board or my trial, it was started from 3.0.1.
v 3.0.0 is working as expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions