json_normalizer 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_normalizer.rb +0 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 205a1d4f70be168c939a23f86d323f687ac735e1
|
4
|
+
data.tar.gz: f6b2e8144cbe813ec13773ee4b8be04f7d76f211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77b53aa9ca3dc1370d059e6ba6429a3eaec2785758450732d69bed7f445367e55f7432637d72ea11d3d54707c7711d2726dc3041bba1c51e63c88cd410bb904
|
7
|
+
data.tar.gz: cd6feae9c2b923e4a9e513c83f940e15898206b74c6bac1f57d74318b7227fa65740e6c25221dc236bbd3377bce31a21bbdea11fe1882b20135311df117656a8
|
data/lib/json_normalizer.rb
CHANGED
@@ -19,15 +19,6 @@ class JsonNormalizer
|
|
19
19
|
@map.keys.each{ |k| return k if @map[k].include?(key) }
|
20
20
|
end
|
21
21
|
|
22
|
-
# def swap_key(json, key)
|
23
|
-
# if self.key_contained?(key)
|
24
|
-
# json[self.fetch_key(key).first] = json[key]
|
25
|
-
# json.delete(key)
|
26
|
-
# else
|
27
|
-
# # if we want to move out non-normalized keys into a different 'misc' key or something
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
|
31
22
|
def swap_key(json, key)
|
32
23
|
if self.key_contained?(key)
|
33
24
|
json[self.fetch_key(key)] = json[key]
|
@@ -42,7 +33,6 @@ class JsonNormalizer
|
|
42
33
|
json.each do |j|
|
43
34
|
j.keys.each do |key|
|
44
35
|
if j[key].respond_to?(:each)
|
45
|
-
puts "Key: #{key} recursing..."
|
46
36
|
self.translate(j[key])
|
47
37
|
self.swap_key(j, key)
|
48
38
|
else
|
@@ -53,7 +43,6 @@ class JsonNormalizer
|
|
53
43
|
else
|
54
44
|
json.keys.each do |key|
|
55
45
|
if json[key].respond_to?(:each)
|
56
|
-
puts "Key: #{key} recursing..."
|
57
46
|
self.translate(json[key])
|
58
47
|
self.swap_key(json, key)
|
59
48
|
else
|
@@ -62,8 +51,6 @@ class JsonNormalizer
|
|
62
51
|
end
|
63
52
|
end
|
64
53
|
|
65
|
-
# json.map{ |k, v| [k.to_s, v] }.to_h
|
66
|
-
# JSON.parse json.to_json
|
67
54
|
json
|
68
55
|
end
|
69
56
|
|