File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -212,10 +212,7 @@ def marshal_dump # :nodoc:
212
212
#
213
213
# Provides marshalling support for use by the Marshal library.
214
214
#
215
- def marshal_load ( x ) # :nodoc:
216
- x . each_key { |key | new_ostruct_member! ( key ) }
217
- @table = x
218
- end
215
+ alias_method :marshal_load , :update_to_values! # :nodoc:
219
216
220
217
#
221
218
# Used internally to defined properties on the
Original file line number Diff line number Diff line change @@ -327,4 +327,10 @@ def test_yaml
327
327
assert_equal true , os1 . eql? ( os2 )
328
328
assert_equal 300.42 , os2 . pension
329
329
end
330
+
331
+ def test_marshal
332
+ o = OpenStruct . new ( name : "John Smith" , age : 70 , pension : 300.42 )
333
+ o2 = Marshal . load ( Marshal . dump ( o ) )
334
+ assert_equal o , o2
335
+ end
330
336
end
You can’t perform that action at this time.
0 commit comments