ruby / csv

CSV Reading and Writing
https://ruby.github.io/csv/
BSD 2-Clause "Simplified" License
177 stars 113 forks source link

Correct the example for CSV.generate_lines #257

Closed sampatbadhe closed 1 year ago

sampatbadhe commented 1 year ago

Correct the example for CSV.generate_lines

3.0.0 :001'> CSV.generate_lines(['foo', '0'], ['bar', '1'], ['baz', '2'])
Traceback (most recent call last):
        3: from bin/console:14:in `<main>'
ArgumentError (wrong number of arguments (given 3, expected 1))
3.0.0 :002 > CSV.generate_lines([['foo', '0'], ['bar', '1'], ['baz', '2']])
 => "foo,0\nbar,1\nbaz,2\n" 
3.0.0 :003 > CSV.generate_lines(:foo)
Traceback (most recent call last):
        5: from bin/console:14:in `<main>'
        4: from (irb):12:in `<main>'
        3: from /csv/lib/csv.rb:1501:in `generate_lines'
        2: from /csv/lib/csv.rb:1409:in `generate'
        1: from /csv/lib/csv.rb:1502:in `block in generate_lines'
NoMethodError (undefined method `each' for :foo:Symbol)
kou commented 1 year ago

Good catch!

cc: @ericgpks

ericgpks commented 1 year ago

I'm so sorry and thank you for your support.