logical_model 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/typhoeus_fix/array_decoder.rb +7 -2
- data/logical_model.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e813874f914e15ae59b5418f3b8f3f7956b634d3b78e6b71b8db7f6d0b24a9
|
4
|
+
data.tar.gz: 34e5a57719bdfaa9d8c5e015f375928f555919a05628fbd7e91b8aa6a690e385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdc851d2855dad7d13c088eb44a16229bd05b57d418149d67af3fcff1d0e952f9e326e052b897c1361acf9da8a20d2667c1a4e8ec969437634801ddf845fe2e0
|
7
|
+
data.tar.gz: d0f140df1accc666f3e33a097f71b2681235dfbeb21a9602ee791d019159ee63495568c2f5db026fdf026e285650da70170ba88a532619205cde879ef687e5b2
|
@@ -33,9 +33,9 @@ module TyphoeusFix
|
|
33
33
|
#
|
34
34
|
# @return [Hash] Hash with properly decoded nested arrays.
|
35
35
|
def decode!(hash)
|
36
|
-
return hash unless
|
36
|
+
return hash unless is_hash?(hash)
|
37
37
|
hash.each_pair do |key,value|
|
38
|
-
if
|
38
|
+
if is_hash?(value)
|
39
39
|
decode!(value)
|
40
40
|
hash[key] = convert(value)
|
41
41
|
end
|
@@ -49,6 +49,10 @@ module TyphoeusFix
|
|
49
49
|
|
50
50
|
private
|
51
51
|
|
52
|
+
def is_hash?(hash)
|
53
|
+
hash.is_a?(Hash) || hash.is_a?(HashWithIndifferentAccess) || hash.is_a?(ActionController::Parameters)
|
54
|
+
end
|
55
|
+
|
52
56
|
# Checks if Hash is an Array encoded as a Hash.
|
53
57
|
# Specifically will check for the Hash to have this
|
54
58
|
# form: {'0' => v0, '1' => v1, .., 'n' => vN }
|
@@ -74,6 +78,7 @@ module TyphoeusFix
|
|
74
78
|
# @return [Arraya/Hash]
|
75
79
|
def convert(hash)
|
76
80
|
if encoded?(hash)
|
81
|
+
hash = hash.to_unsafe_h if hash.respond_to?(:to_unsafe_h)
|
77
82
|
Hash[hash.sort_by{|k,v|k.to_i}].values
|
78
83
|
else
|
79
84
|
hash
|
data/logical_model.gemspec
CHANGED