recursive-open-struct 2.0.0 → 2.1.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/.github/workflows/ruby.yml +3 -2
- data/AUTHORS.txt +3 -1
- data/CHANGELOG.md +8 -0
- data/lib/recursive_open_struct/version.rb +1 -1
- data/lib/recursive_open_struct.rb +1 -0
- data/recursive-open-struct.gemspec +6 -4
- data/spec/recursive_open_struct/wrapping_spec.rb +70 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d47dc026bcadbac598558f8734a4bce1cf17312fcbe915925e92b684c41da5b0
|
|
4
|
+
data.tar.gz: 11603a372dbfc88cfa339b0923be134fea27ee333d22e7181fe5f68ef13c6a72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70fd0af15429eb9d81f09c42c36b81f2befc1068d097bc098054d44bb28dbe0545962cfd2f02398e5125d376f58acf9a3691cf0bfbb710317ad677e8081b00f6
|
|
7
|
+
data.tar.gz: 6d2088207848433c2c6e640505df65099f85ead90ae8c598dbe020c6c7b4b185f77f347df6d6e87b693f42807d6d835d73012d42dee1ff843bf430e6cfb0b3a3
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -21,8 +21,9 @@ jobs:
|
|
|
21
21
|
|
|
22
22
|
runs-on: ubuntu-latest
|
|
23
23
|
strategy:
|
|
24
|
+
fail-fast: false
|
|
24
25
|
matrix:
|
|
25
|
-
ruby-version: ['3.
|
|
26
|
+
ruby-version: ['3.2', '3.3', '3.4', head, jruby, jruby-head]
|
|
26
27
|
|
|
27
28
|
steps:
|
|
28
29
|
- uses: actions/checkout@v4
|
|
@@ -30,7 +31,7 @@ jobs:
|
|
|
30
31
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
31
32
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
32
33
|
# uses: ruby/setup-ruby@v1
|
|
33
|
-
uses: ruby/setup-ruby@
|
|
34
|
+
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # 1.268.0
|
|
34
35
|
with:
|
|
35
36
|
ruby-version: ${{ matrix.ruby-version }}
|
|
36
37
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
data/AUTHORS.txt
CHANGED
|
@@ -9,6 +9,7 @@ Recursive-open-struct was written by these fine people:
|
|
|
9
9
|
* Federico Aloi <federico.aloi@gmail.com>
|
|
10
10
|
* fervic <roberto@runawaybit.com>
|
|
11
11
|
* Hartley McGuire <skipkayhil@gmail.com>
|
|
12
|
+
* Hermann Mayer <hermann.mayer92@gmail.com>
|
|
12
13
|
* Igor Victor <gogainda@yandex.ru>
|
|
13
14
|
* Ilya Umanets <ilya.umanets@sabiogroup.com>
|
|
14
15
|
* Jean Boussier <jean.boussier@gmail.com>
|
|
@@ -21,11 +22,12 @@ Recursive-open-struct was written by these fine people:
|
|
|
21
22
|
* Pedro Sena <sena.pedro@gmail.com>
|
|
22
23
|
* Peter Yeremenko <peter.yeremenko@gmail.com>
|
|
23
24
|
* Pirate Praveen <praveen@debian.org>
|
|
24
|
-
* Richard Degenne <richard.degenne+github@gmail.com>
|
|
25
25
|
* Richard Degenne <richard.degenne@gmail.com>
|
|
26
|
+
* Richard Degenne <richard.degenne+github@gmail.com>
|
|
26
27
|
* Sebastian Gaul <sebastian@mgvmedia.com>
|
|
27
28
|
* Thiago Guimaraes <thiagogsr@gmail.com>
|
|
28
29
|
* Tom Chapin <tchapin@gmail.com>
|
|
29
30
|
* Victor Guzman <victor.guzman@runawaybit.com>
|
|
30
31
|
* William (B.J.) Snow Orvis <aetherknight@gmail.com>
|
|
32
|
+
* Wynn (B.J.) Snow Orvis <aetherkn@aedifice.org>
|
|
31
33
|
* Wynn (B.J.) Snow Orvis <aetherknight@gmail.com>
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
2.1.0 / 2025/12/05
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
* [#80](https://github.com/aetherknight/recursive-open-struct/pull/80): Hermann
|
|
5
|
+
Mayer: Added a safety guard for double wrapping.
|
|
6
|
+
* FIX: Avoid loading `ostruct` when processing the gemspec, since it is a
|
|
7
|
+
dependency and it may not be installed/available yet.
|
|
8
|
+
|
|
1
9
|
2.0.0 / 2024/10/03
|
|
2
10
|
==================
|
|
3
11
|
|
|
@@ -29,6 +29,7 @@ class RecursiveOpenStruct < OpenStruct
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def initialize(hash=nil, passed_options={})
|
|
32
|
+
hash = hash.to_h if [hash.is_a?(RecursiveOpenStruct), hash.is_a?(OpenStruct)].any?
|
|
32
33
|
hash ||= {}
|
|
33
34
|
|
|
34
35
|
@options = self.class.default_options.merge!(passed_options).freeze
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
name = "recursive-open-struct"
|
|
3
|
+
version = File.foreach(File.join(__dir__, "lib", "recursive_open_struct", "version.rb")) do |line|
|
|
4
|
+
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
|
|
5
|
+
end
|
|
4
6
|
|
|
5
7
|
Gem::Specification.new do |s|
|
|
6
|
-
s.name =
|
|
7
|
-
s.version =
|
|
8
|
+
s.name = name
|
|
9
|
+
s.version = version
|
|
8
10
|
s.authors = ["William (B.J.) Snow Orvis"]
|
|
9
11
|
s.email = "aetherknight@gmail.com"
|
|
10
12
|
s.date = Time.now.utc.strftime("%Y-%m-%d")
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require_relative '../spec_helper'
|
|
2
|
+
require 'recursive_open_struct'
|
|
3
|
+
|
|
4
|
+
describe RecursiveOpenStruct do
|
|
5
|
+
describe 'wrapping RecursiveOpenStruct' do
|
|
6
|
+
let(:h) { { :blah => { :another => 'value' } } }
|
|
7
|
+
subject(:ros) { RecursiveOpenStruct.new(RecursiveOpenStruct.new(h)) }
|
|
8
|
+
|
|
9
|
+
it 'can convert the entire hash tree back into a hash' do
|
|
10
|
+
expect(ros.to_h).to eq h
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'can access the flat keys' do
|
|
14
|
+
expect(ros.blah).to be_a(RecursiveOpenStruct)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'can access the nested keys' do
|
|
18
|
+
expect(ros.blah.another).to eql('value')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'can be inspected' do
|
|
22
|
+
expect(ros.inspect).to \
|
|
23
|
+
match(/#<RecursiveOpenStruct blah={:?another(: |=>)"value"}>/)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe 'wrapping OpenStruct' do
|
|
28
|
+
let(:h) { { :blah => { :another => 'value' } } }
|
|
29
|
+
subject(:ros) { RecursiveOpenStruct.new(OpenStruct.new(h)) }
|
|
30
|
+
|
|
31
|
+
it 'can convert the entire hash tree back into a hash' do
|
|
32
|
+
expect(ros.to_h).to eq h
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'can access the flat keys' do
|
|
36
|
+
expect(ros.blah).to be_a(RecursiveOpenStruct)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'can access the nested keys' do
|
|
40
|
+
expect(ros.blah.another).to eql('value')
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'can be inspected' do
|
|
44
|
+
expect(ros.inspect).to \
|
|
45
|
+
match(/#<RecursiveOpenStruct blah={:?another(: |=>)"value"}>/)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe 'wrapping a subclass' do
|
|
50
|
+
let(:h) { { :blah => { :another => 'value' } } }
|
|
51
|
+
let(:subclass) { Class.new(RecursiveOpenStruct) }
|
|
52
|
+
subject(:ros) { subclass.new(subclass.new(h)) }
|
|
53
|
+
|
|
54
|
+
it 'can convert the entire hash tree back into a hash' do
|
|
55
|
+
expect(ros.to_h).to eq h
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'can access the flat keys' do
|
|
59
|
+
expect(ros.blah).to be_a(RecursiveOpenStruct)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'can access the nested keys' do
|
|
63
|
+
expect(ros.blah.another).to eql('value')
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'can be inspected' do
|
|
67
|
+
expect(ros.inspect).to match(/ blah={:?another(: |=>)"value"}>$/)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
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: 2.
|
|
4
|
+
version: 2.1.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:
|
|
11
|
+
date: 2025-12-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -153,6 +153,7 @@ files:
|
|
|
153
153
|
- spec/recursive_open_struct/ostruct_2_3_0_spec.rb
|
|
154
154
|
- spec/recursive_open_struct/recursion_and_subclassing_spec.rb
|
|
155
155
|
- spec/recursive_open_struct/recursion_spec.rb
|
|
156
|
+
- spec/recursive_open_struct/wrapping_spec.rb
|
|
156
157
|
- spec/spec_helper.rb
|
|
157
158
|
homepage: https://github.com/aetherknight/recursive-open-struct
|
|
158
159
|
licenses:
|
|
@@ -185,4 +186,5 @@ test_files:
|
|
|
185
186
|
- spec/recursive_open_struct/ostruct_2_3_0_spec.rb
|
|
186
187
|
- spec/recursive_open_struct/recursion_and_subclassing_spec.rb
|
|
187
188
|
- spec/recursive_open_struct/recursion_spec.rb
|
|
189
|
+
- spec/recursive_open_struct/wrapping_spec.rb
|
|
188
190
|
- spec/spec_helper.rb
|