recursive-open-struct 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHORS.txt +3 -0
- data/CHANGELOG.md +9 -0
- data/lib/recursive_open_struct/version.rb +1 -1
- data/lib/recursive_open_struct.rb +10 -0
- data/recursive-open-struct.gemspec +2 -0
- data/spec/recursive_open_struct/recursion_spec.rb +19 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a83d546ac9236ddec7aea76146c3cfaeec9154e29d51eb64bb776c466f46d64d
|
4
|
+
data.tar.gz: c2d441baa55eb614a00371510f2471b464ce330b747b2e5348f6a67dfdab3910
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4845a659ae543e5b6674376624d12181741d21cfdeb92ff2f4cdcd2537d9977c0ce273a0ae683a7304da25552350187df31675b0e75d0a84ed0e820b5a4e8438
|
7
|
+
data.tar.gz: a9395fd868f4cddf829d3a76c39a3f071b548502f05c127e96dbedfc630443ef378ed7ade87ad6b5f7e5f8f49d898e81eb261b804c20f727ab6f13629d49ffe1
|
data/AUTHORS.txt
CHANGED
@@ -8,11 +8,13 @@ Recursive-open-struct was written by these fine people:
|
|
8
8
|
* Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
|
9
9
|
* Federico Aloi <federico.aloi@gmail.com>
|
10
10
|
* fervic <roberto@runawaybit.com>
|
11
|
+
* Hartley McGuire <skipkayhil@gmail.com>
|
11
12
|
* Igor Victor <gogainda@yandex.ru>
|
12
13
|
* Ilya Umanets <ilya.umanets@sabiogroup.com>
|
13
14
|
* Jean Boussier <jean.boussier@gmail.com>
|
14
15
|
* Joe Rafaniello <jrafanie@redhat.com>
|
15
16
|
* Kris Dekeyser <kris.dekeyser@libis.be>
|
17
|
+
* Maple Ong <maple.ong@gusto.com>
|
16
18
|
* Matt Culpepper <matt@culpepper.co>
|
17
19
|
* Matthew O'Riordan <matthew.oriordan@gmail.com>
|
18
20
|
* Offirmo <offirmo.net@gmail.com>
|
@@ -26,3 +28,4 @@ Recursive-open-struct was written by these fine people:
|
|
26
28
|
* Tom Chapin <tchapin@gmail.com>
|
27
29
|
* Victor Guzman <victor.guzman@runawaybit.com>
|
28
30
|
* William (B.J.) Snow Orvis <aetherknight@gmail.com>
|
31
|
+
* Wynn (B.J.) Snow Orvis <aetherknight@gmail.com>
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
1.3.0 / 2024/10/01
|
2
|
+
==================
|
3
|
+
|
4
|
+
* [#72](https://github.com/aetherknight/recursive-open-struct/pull/72): Maple
|
5
|
+
Ong: Better handle marshalling and dumping ROS
|
6
|
+
* [#78](https://github.com/aetherknight/recursive-open-struct/pull/78): Hartley
|
7
|
+
McGuire: Add ostruct as a dependency since newer Ruby versions are going to
|
8
|
+
remove it
|
9
|
+
|
1
10
|
1.2.2 / 2024/06/18
|
2
11
|
==================
|
3
12
|
|
@@ -40,6 +40,16 @@ class RecursiveOpenStruct < OpenStruct
|
|
40
40
|
@sub_elements = {}
|
41
41
|
end
|
42
42
|
|
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
|
43
53
|
|
44
54
|
if OpenStruct.public_instance_methods.include?(:initialize_copy)
|
45
55
|
def initialize_copy(orig)
|
@@ -37,6 +37,14 @@ describe RecursiveOpenStruct do
|
|
37
37
|
expect(ros.blah.changed).to eql 'backing'
|
38
38
|
end
|
39
39
|
|
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
|
+
|
40
48
|
describe "handling loops in the original Hashes" do
|
41
49
|
let(:h1) { { :a => 'a'} }
|
42
50
|
let(:h2) { { :a => 'b', :h1 => h1 } }
|
@@ -182,6 +190,17 @@ describe RecursiveOpenStruct do
|
|
182
190
|
let(:blah_list) { [ { :foo => '1' }, { :foo => '2' }, 'baz' ] }
|
183
191
|
let(:h) { { :blah => blah_list } }
|
184
192
|
|
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
|
+
|
185
204
|
context "when recursing over arrays is enabled" do
|
186
205
|
subject { RecursiveOpenStruct.new(h, :recurse_over_arrays => true) }
|
187
206
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recursive-open-struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William (B.J.) Snow Orvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ostruct
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: |
|
98
112
|
RecursiveOpenStruct is a subclass of OpenStruct. It differs from
|
99
113
|
OpenStruct in that it allows nested hashes to be treated in a recursive
|