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

Cloning rows #39

Closed
andresakata opened this issue Jun 25, 2018 · 2 comments
Closed

Cloning rows #39

andresakata opened this issue Jun 25, 2018 · 2 comments

Comments

@andresakata
Copy link

andresakata commented Jun 25, 2018

Is this behavior correct when cloning a CSV::Row?

irb(main):006:0> row = CSV::Row.new([:name], ['Andre'])
=> #<CSV::Row name:"Andre">
irb(main):007:0> row[:name]
=> "Andre"
irb(main):008:0> dup_row = row.dup
=> #<CSV::Row name:"Andre">
irb(main):009:0> dup_row[:name]
=> "Andre"
irb(main):010:0> dup_row.delete(:name)
=> [:name, "Andre"]
irb(main):011:0> dup_row[:name]
=> nil
irb(main):012:0> row['name']
=> nil

I expected that when modifying the duplicated row would not change the original object.

Using ruby 2.5.1p57

@kou kou closed this as completed in 7f93155 Jun 26, 2018
@kou
Copy link
Member

kou commented Jun 26, 2018

I've added support for the feature.

@andresakata
Copy link
Author

Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants