resource-struct 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/resource_struct/extensions/indifferent_lookup.rb +9 -5
- data/lib/resource_struct/flex_struct.rb +5 -3
- data/lib/resource_struct/strict_struct.rb +1 -1
- data/lib/resource_struct/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dae7c6c56053d571217150d28f4f70dc6c8c28524d360460e328d09034c17ea
|
4
|
+
data.tar.gz: 85a4dc5b15dcb2af42f30ad4e9daa66e3e16b727934305c46e06536a23e6a90c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 781fab03b76d80ba0169635168f46e5cefef893ea7f9dd0a15d5dbed1c9dc211b7ebfef024288f2335a1d3dd50bd920b056b22f7e23d0d2ebddae0178b32b6f6
|
7
|
+
data.tar.gz: 64b857102c619e60462d4919021735162c2c991e4bb65ad5096576af4620f866c15b91dbff3062cc1494aa1c94c05d4e29fbe9ad5745f895468e8d0ed80a232a
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -35,10 +35,12 @@ module ResourceStruct
|
|
35
35
|
result =
|
36
36
|
if @ro_struct.key?(ckey)
|
37
37
|
@ro_struct[ckey]
|
38
|
-
elsif key
|
39
|
-
@ro_struct[ckey] = ___convert_value(@hash[key]
|
40
|
-
|
41
|
-
@ro_struct[ckey] = ___convert_value(@hash[key]
|
38
|
+
elsif @hash.key?(key)
|
39
|
+
@ro_struct[ckey] = ___convert_value(@hash[key])
|
40
|
+
elsif key.is_a?(String) && @hash.key?(key.to_sym)
|
41
|
+
@ro_struct[ckey] = ___convert_value(@hash[key.to_sym])
|
42
|
+
elsif key.is_a?(Symbol) && @hash.key?(key.to_s)
|
43
|
+
@ro_struct[ckey] = ___convert_value(@hash[key.to_s])
|
42
44
|
end
|
43
45
|
|
44
46
|
return result if sub_keys.empty?
|
@@ -76,7 +78,9 @@ module ResourceStruct
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def ___key?(key)
|
79
|
-
@hash.key?(key) ||
|
81
|
+
@hash.key?(key) ||
|
82
|
+
@hash.key?(___convert_key(key)) ||
|
83
|
+
key.is_a?(String) && @hash.key?(key.to_sym)
|
80
84
|
end
|
81
85
|
|
82
86
|
def ___convert_key(key)
|
@@ -27,8 +27,10 @@ module ResourceStruct
|
|
27
27
|
|
28
28
|
if @hash.key?(key)
|
29
29
|
@hash[key] = value
|
30
|
-
elsif key.is_a?(String)
|
30
|
+
elsif key.is_a?(String) && @hash.key?(key.to_sym)
|
31
31
|
@hash[key.to_sym] = value
|
32
|
+
elsif key.is_a?(Symbol) && @hash.key?(key.to_s)
|
33
|
+
@hash[key.to_s] = value
|
32
34
|
else
|
33
35
|
@hash[key] = value
|
34
36
|
end
|
@@ -43,8 +45,8 @@ module ResourceStruct
|
|
43
45
|
nil
|
44
46
|
end
|
45
47
|
|
46
|
-
def respond_to_missing?(
|
47
|
-
|
48
|
+
def respond_to_missing?(name, include_private = false)
|
49
|
+
___key?(name) || ___key?(name.to_s.chomp("?")) || super
|
48
50
|
end
|
49
51
|
end
|
50
52
|
LooseStruct = FlexStruct
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resource-struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Riedler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-01-05 00:00:00.000000000 Z
|
@@ -41,7 +41,7 @@ metadata:
|
|
41
41
|
homepage_uri: https://github.com/AlexRiedler/resource-struct
|
42
42
|
source_code_uri: https://github.com/AlexRiedler/resource-struct
|
43
43
|
changelog_uri: https://raw.githubusercontent.com/AlexRiedler/resource-struct/master/CHANGELOG.md
|
44
|
-
post_install_message:
|
44
|
+
post_install_message:
|
45
45
|
rdoc_options: []
|
46
46
|
require_paths:
|
47
47
|
- lib
|
@@ -56,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
requirements: []
|
59
|
-
rubygems_version: 3.
|
60
|
-
signing_key:
|
59
|
+
rubygems_version: 3.0.3
|
60
|
+
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: Ruby structs for resource responses
|
63
63
|
test_files: []
|