File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,6 @@ def cast_values(type_overrides = nil) # :nodoc:
208
208
209
209
def initialize_copy ( other )
210
210
@rows = rows . dup
211
- @column_types = column_types . dup
212
211
@hash_rows = nil
213
212
end
214
213
@@ -239,6 +238,11 @@ def indexed_rows # :nodoc:
239
238
end
240
239
end
241
240
241
+ protected
242
+ def raw_column_types
243
+ @column_types
244
+ end
245
+
242
246
private
243
247
def column_type ( name , index , type_overrides )
244
248
if type_overrides
Original file line number Diff line number Diff line change @@ -129,5 +129,23 @@ def result
129
129
assert_equal "col 2" , row [ "foo" ]
130
130
end
131
131
end
132
+
133
+ test "dup preserve all attributes" do
134
+ a = result
135
+ b = a . dup
136
+
137
+ assert_equal a . column_types , b . column_types
138
+ assert_equal a . columns , b . columns
139
+ assert_equal a . rows , b . rows
140
+ assert_equal a . column_indexes , b . column_indexes
141
+
142
+ # Second round in case of mutation
143
+ b = b . dup
144
+
145
+ assert_equal a . column_types , b . column_types
146
+ assert_equal a . columns , b . columns
147
+ assert_equal a . rows , b . rows
148
+ assert_equal a . column_indexes , b . column_indexes
149
+ end
132
150
end
133
151
end
You can’t perform that action at this time.
0 commit comments