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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96dad22f02249aef4645ed0fe38a682480dca110dd98bf6886a9dd2683afd1ce
4
- data.tar.gz: '09f796883e362201f81ae647718f38640753874bceb8d5aca5d4de48fac79f33'
3
+ metadata.gz: fa87187b7f75ecaa025e9e1a7afc160673b527b630bf571b42d8c6b29c786c22
4
+ data.tar.gz: 734ab18ac3379b7a6f3dbde3c2827a8fac2bb8f3b820fed95a2f3cfe7610dbc1
5
5
  SHA512:
6
- metadata.gz: d1e2c900a216bfe9a6ac8b41b6c2c3ba965bb748090bd43317c8d9f3a1412950ed22185bdb7bd87f94da35f6dcc5b44123af932286e9692303bf1e18fbd30c17
7
- data.tar.gz: 50c568c4374b2b30e7f5815eafb0252c7a4e63c94a073360021bae109832ef7bf7de63e6da4c454dad7f35f329d7c8a64f3cfb1ee106fc3a043307980feb922b
6
+ metadata.gz: e706e542d5f4d766ed2db98c4c52ec38f9bf084b93f3f68e326dc227d1f18829b9dbfd50d92fb85a3706baea014d4f176d2c76218009414e6c39da28ae39ec6d
7
+ data.tar.gz: 0fd6b5602395ca1d1f5d376d5019eb437426711c44d9b0d5f11f1c3d2f3076ccea82b0aefe092caef1f3177bbbe7c94497ce6f0032ce52df848ffc16f477327e
@@ -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?(Panko::ArraySerializer) ||
25
- value.is_a?(Panko::Serializer) ||
26
- value.is_a?(Panko::Response)
27
- writer.push_json(value.to_json, key)
28
- elsif value.is_a?(Panko::JsonValue)
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Panko
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panko_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yosi Attias