Skip to content

Cloning rows #39

Closed
Closed
@andresakata

Description

@andresakata

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

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