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

Correct the example for CSV.generate_lines #257

Merged
merged 1 commit into from Aug 27, 2022

Conversation

sampatbadhe
Copy link
Contributor

@sampatbadhe sampatbadhe commented Aug 27, 2022

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 kou merged commit a171621 into ruby:master Aug 27, 2022
@kou
Copy link
Member

kou commented Aug 27, 2022

Good catch!

cc: @ericgpks

@ericgpks
Copy link
Contributor

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

@sampatbadhe sampatbadhe deleted the improve-doc-for-generate-lines branch October 24, 2022 17:50
peterzhu2118 pushed a commit to Shopify/ruby that referenced this pull request Dec 6, 2022
(ruby/csv#257)

```ruby
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)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants