summaryrefslogtreecommitdiff
path: root/lib/csv
diff options
context:
space:
mode:
authorJim Kane <fastjames@gmail.com>2019-10-22 05:01:24 -0500
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-20 02:32:49 +0900
commitb219cd5ac36ffb733e3eccd98d53ecf660dee5bf (patch)
treebaed761723093ea3bfeb4ea92f063dad3a0145fb /lib/csv
parent9141aae8c2e2cf9ccf38a8c12828b284297c264b (diff)
[ruby/csv] Make CSV::Row#dup return a usable Row (#108)
* Make CSV::Row#dup return a usable Row Previously, calling `dup` on a `CSV::Row` object yielded an object whose copy was too shallow. Changing the clone's fields would also change the fields on the source. This change makes the clone more distinct from the source, so that changes can be made to its fields without affecting the source. * Simplify https://github.com/ruby/csv/commit/64a1ea06fc
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3332
Diffstat (limited to 'lib/csv')
-rw-r--r--lib/csv/row.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/csv/row.rb b/lib/csv/row.rb
index 4aa0f30911..a2d03e855f 100644
--- a/lib/csv/row.rb
+++ b/lib/csv/row.rb
@@ -50,7 +50,7 @@ class CSV
def initialize_copy(other)
super
- @row = @row.dup
+ @row = @row.collect(&:dup)
end
# Returns +true+ if this is a header row.