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:
208208
209209 def initialize_copy ( other )
210210 @rows = rows . dup
211- @column_types = column_types . dup
212211 @hash_rows = nil
213212 end
214213
@@ -239,6 +238,11 @@ def indexed_rows # :nodoc:
239238 end
240239 end
241240
241+ protected
242+ def raw_column_types
243+ @column_types
244+ end
245+
242246 private
243247 def column_type ( name , index , type_overrides )
244248 if type_overrides
Original file line number Diff line number Diff line change @@ -129,5 +129,23 @@ def result
129129 assert_equal "col 2" , row [ "foo" ]
130130 end
131131 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
132150 end
133151end
You can’t perform that action at this time.
0 commit comments