csv-diff icon indicating copy to clipboard operation
csv-diff copied to clipboard

Broken on ruby 2.2.2

Open DanielHeath opened this issue 10 years ago • 4 comments
trafficstars

Parsing a csv now gives you a CSV::Row, which doesn't respond to +.

`'get_diff_fields': undefined method + for #CSV::Row:0x007f91dba5fe50 (NoMethodError).

DanielHeath avatar Jul 03 '15 12:07 DanielHeath

Can you show me what arguments you are passing to CSVDiff.initialize?

agardiner avatar Jul 03 '15 15:07 agardiner

git clone https://gist.github.com/015432bd43c5ad8d55e9.git should have a repro.

DanielHeath avatar Jul 03 '15 23:07 DanielHeath

I've tested on the latest gem release, and master.

DanielHeath avatar Jul 03 '15 23:07 DanielHeath

OK, I don't think this is anything to do with using Ruby 2.2.2; instead, by passing in the headers: true option to CSVDiff.new, you are instructing CSV to return CSV::Row objects instead of an Array. If you omit this option, CSVDiff will assume the first row contains headers anyway. I will also think about a fix to prevent the error with this usage, which is not at all unreasonable.

agardiner avatar Jul 04 '15 09:07 agardiner