Skip to content

Commit e33e1ec

Browse files
committed
Remove @sub_elements from serialization as it's a cache
We can recreate the hash at load.
1 parent 2d2271d commit e33e1ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/recursive_open_struct.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ def initialize(hash=nil, passed_options={})
4040
end
4141

4242
def marshal_load(attributes)
43-
hash, @options, @sub_elements = attributes
43+
hash, @options = attributes
44+
@sub_elements = {}
4445
super(hash)
4546
end
4647

4748
def marshal_dump
48-
[super, @options, @sub_elements]
49+
[super, @options]
4950
end
5051

5152
if OpenStruct.public_instance_methods.include?(:initialize_copy)

0 commit comments

Comments
 (0)