panko_serializer 0.5.1 → 0.5.2

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: 3a76c5943a2aa638978b5c044203810bbd993e66a9d18c584149ec0fab559a27
4
- data.tar.gz: b7e7337631ba79c9226e5a1e95f2190f2598ca768056b98bf160159ac7b192b4
3
+ metadata.gz: a6b6564ceb0042f812b605b237ac6b5311a320d2cf44445f34276c1747b6609c
4
+ data.tar.gz: 9a52ca30b949c72abf36f8e7dbd891d196fbdb8cebd4fd569155fa55eb0d6263
5
5
  SHA512:
6
- metadata.gz: c366b1a541ccc4575bef00ffacb06fe18693e0018f7f2c08bd6350dba7a39832f58cf1ba69f0bfcdd82e1b6bbd2b28274089382d521e070fb307a2b064ff1e1f
7
- data.tar.gz: 02cec8e1f86cae29072071d52c0249400fbf73b6ffaa12a70653b0f6f18754269a31af6534ef36051e49ed3d83c5c61e094d7068c9c53ad6b19a28cfa20537d8
6
+ metadata.gz: 80bb72b9a46ad8bc30de021ac32b3167d3c2659f7dd37d06d3a60935ad3e9c3bc2538ab92497dd8bf834e74f76890be77aab18bc4a01afa7a79a634881e7e442
7
+ data.tar.gz: 84330bd443f13277650d64444fb0270542eddf77cd559142a8ca10feb33d646049ac0f9b024072f403de7bb7878a2321ee2b6cc4948420f4e11654a3def31a65
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Panko
4
+ class Association
5
+ def duplicate
6
+ Panko::Association.new(
7
+ name_sym,
8
+ name_str,
9
+ Panko::SerializationDescriptor.duplicate(descriptor)
10
+ )
11
+ end
12
+
13
+ def inspect
14
+ "<Panko::Attribute name=#{name_str.inspect}>"
15
+ end
16
+ end
17
+ end
@@ -30,10 +30,10 @@ module Panko
30
30
  backend.attributes = descriptor.attributes.dup
31
31
 
32
32
  backend.method_fields = descriptor.method_fields.dup
33
- backend.serializer = descriptor.type.new(_skip_init: true)
33
+ backend.serializer = descriptor.type.new(_skip_init: true) unless backend.method_fields.empty?
34
34
 
35
- backend.has_many_associations = descriptor.has_many_associations.dup
36
- backend.has_one_associations = descriptor.has_one_associations.dup
35
+ backend.has_many_associations = descriptor.has_many_associations.map(&:duplicate)
36
+ backend.has_one_associations = descriptor.has_one_associations.map(&:duplicate)
37
37
 
38
38
  backend
39
39
  end
data/lib/panko/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Panko
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "panko/version"
4
4
  require "panko/attribute"
5
+ require "panko/association"
5
6
  require "panko/serializer"
6
7
  require "panko/array_serializer"
7
8
  require "panko/response"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panko_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yosi Attias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-11 00:00:00.000000000 Z
11
+ date: 2018-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -88,6 +88,7 @@ files:
88
88
  - ext/panko_serializer/serialization_descriptor/serialization_descriptor.c
89
89
  - ext/panko_serializer/serialization_descriptor/serialization_descriptor.h
90
90
  - lib/panko/array_serializer.rb
91
+ - lib/panko/association.rb
91
92
  - lib/panko/attribute.rb
92
93
  - lib/panko/response.rb
93
94
  - lib/panko/serialization_descriptor.rb