panko_serializer 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/panko/response.rb +22 -8
- data/lib/panko/version.rb +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: fa87187b7f75ecaa025e9e1a7afc160673b527b630bf571b42d8c6b29c786c22
|
4
|
+
data.tar.gz: 734ab18ac3379b7a6f3dbde3c2827a8fac2bb8f3b820fed95a2f3cfe7610dbc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e706e542d5f4d766ed2db98c4c52ec38f9bf084b93f3f68e326dc227d1f18829b9dbfd50d92fb85a3706baea014d4f176d2c76218009414e6c39da28ae39ec6d
|
7
|
+
data.tar.gz: 0fd6b5602395ca1d1f5d376d5019eb437426711c44d9b0d5f11f1c3d2f3076ccea82b0aefe092caef1f3177bbbe7c94497ce6f0032ce52df848ffc16f477327e
|
data/lib/panko/response.rb
CHANGED
@@ -21,20 +21,34 @@ module Panko
|
|
21
21
|
@data.each do |key, value|
|
22
22
|
key = key.to_s
|
23
23
|
|
24
|
-
if value.is_a?
|
25
|
-
|
26
|
-
|
27
|
-
writer.
|
28
|
-
|
29
|
-
writer.push_json(value.value, key)
|
30
|
-
else
|
31
|
-
writer.push_value(value, key)
|
24
|
+
if value.is_a? Array
|
25
|
+
writer.push_array key
|
26
|
+
value.each { |v| write_object(writer, v) }
|
27
|
+
writer.pop
|
28
|
+
next
|
32
29
|
end
|
30
|
+
|
31
|
+
write_object writer, value, key
|
32
|
+
|
33
33
|
end
|
34
34
|
|
35
35
|
writer.pop
|
36
36
|
|
37
37
|
writer.to_s
|
38
38
|
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def write_object(writer, value, key = nil)
|
43
|
+
if value.is_a?(Panko::ArraySerializer) ||
|
44
|
+
value.is_a?(Panko::Serializer) ||
|
45
|
+
value.is_a?(Panko::Response)
|
46
|
+
writer.push_json(value.to_json, key)
|
47
|
+
elsif value.is_a?(Panko::JsonValue)
|
48
|
+
writer.push_json(value.value, key)
|
49
|
+
else
|
50
|
+
writer.push_value(value, key)
|
51
|
+
end
|
52
|
+
end
|
39
53
|
end
|
40
54
|
end
|
data/lib/panko/version.rb
CHANGED