Skip to content

Commit 49265a8

Browse files
committed
Revert "Merge pull request #72 from wildmaples/fix-marshal-load-issue"
This reverts commit 7ece1dd, reversing changes made to 09f651d.
1 parent 3f526d5 commit 49265a8

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

lib/recursive_open_struct.rb

-10
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ def initialize(hash=nil, passed_options={})
4040
@sub_elements = {}
4141
end
4242

43-
def marshal_load(attributes)
44-
hash, @options = attributes
45-
@deep_dup = DeepDup.new(@options)
46-
@sub_elements = {}
47-
super(hash)
48-
end
49-
50-
def marshal_dump
51-
[super, @options]
52-
end
5343

5444
if OpenStruct.public_instance_methods.include?(:initialize_copy)
5545
def initialize_copy(orig)

spec/recursive_open_struct/recursion_spec.rb

-19
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@
3737
expect(ros.blah.changed).to eql 'backing'
3838
end
3939

40-
it "handles being dump then loaded by Marshal" do
41-
foo_struct = [RecursiveOpenStruct.new]
42-
bar_struct = RecursiveOpenStruct.new(foo: foo_struct)
43-
serialized = Marshal.dump(bar_struct)
44-
45-
expect(Marshal.load(serialized).foo).to eq(foo_struct)
46-
end
47-
4840
describe "handling loops in the original Hashes" do
4941
let(:h1) { { :a => 'a'} }
5042
let(:h2) { { :a => 'b', :h1 => h1 } }
@@ -190,17 +182,6 @@
190182
let(:blah_list) { [ { :foo => '1' }, { :foo => '2' }, 'baz' ] }
191183
let(:h) { { :blah => blah_list } }
192184

193-
context "when dump and loaded by Marshal" do
194-
let(:test) { RecursiveOpenStruct.new(h, :recurse_over_arrays => true) }
195-
subject { Marshal.load(Marshal.dump(test))}
196-
197-
it { expect(subject.blah.length).to eq 3 }
198-
it { expect(subject.blah[0].foo).to eq '1' }
199-
it { expect(subject.blah[1].foo).to eq '2' }
200-
it { expect(subject.blah_as_a_hash).to eq blah_list }
201-
it { expect(subject.blah[2]).to eq 'baz' }
202-
end
203-
204185
context "when recursing over arrays is enabled" do
205186
subject { RecursiveOpenStruct.new(h, :recurse_over_arrays => true) }
206187

0 commit comments

Comments
 (0)