graphiti 1.2.37 → 1.2.38

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: 1ae9a52df4d54256b453573dc02f8eb2d8b1ad062eec7b38be89e3fbc7c6a9f3
4
- data.tar.gz: 99ce6f9e0067eae81661338a933561b2c573b8a78bd92551d6ef5b21a16e6cdf
3
+ metadata.gz: c269e7e8afb7836e7d20aa4d8f837f10ef8576356da1d8c76b93b40bc630a97c
4
+ data.tar.gz: 29ffb9ec585198d92ab8cb75f23562f96ad8f82115301844b389374cbc94cd67
5
5
  SHA512:
6
- metadata.gz: d77c8c268ef6c44b0557cf50fd3ecdfc71013fd25545cac6a935afd48f7e40caf47045af60649e03bf4f5ee01d8269d05f6be5991bc26a3c6303b7eb2d537afb
7
- data.tar.gz: e83bf82263f8b59b2e10a243238c85204631f0eca55ed3306d07129f30d099421d4b518c841bf460187329760d0f9920ff90f5136797cfa1ed13d5cf18d90b3d
6
+ metadata.gz: a5cfe7c03f2a66e3f874902030e56aed8561ed81b4dd5bca849bee82b902d908f4faa32131842220fa1b010b9c2b2276b9158a852e2cf58ddf6f4b5118769dd1
7
+ data.tar.gz: 39b5ffbfa860fcdf1601c2f718c75d401bb2851a1c1c496f5930a81d64329845bba0d4fa7312128d8da25bfe07624fc2be777ccaf768257ae4d6d0291d6796d8
@@ -16,13 +16,11 @@ module Graphiti
16
16
 
17
17
  if @name == :id
18
18
  @serializer.id(&proc)
19
- elsif @attr[:proc]
19
+ elsif @attr[:proc] ||
20
+ !previously_applied? ||
21
+ previously_applied_via_resource?
20
22
  @serializer.send(_method, @name, serializer_options, &proc)
21
- elsif @serializer.attribute_blocks[@name].nil?
22
- @serializer.send(_method, @name, serializer_options, &proc)
23
- elsif @serializer.send(applied_method).include?(@name)
24
- @serializer.field_condition_blocks[@name] = guard if guard?
25
- else
23
+ else # Previously applied via explicit serializer, so wrap it
26
24
  inner = @serializer.attribute_blocks.delete(@name)
27
25
  wrapped = wrap_proc(inner)
28
26
  @serializer.send(_method, @name, serializer_options, &wrapped)
@@ -34,6 +32,14 @@ module Graphiti
34
32
 
35
33
  private
36
34
 
35
+ def previously_applied?
36
+ @serializer.attribute_blocks[@name].present?
37
+ end
38
+
39
+ def previously_applied_via_resource?
40
+ @serializer.send(applied_method).include?(@name)
41
+ end
42
+
37
43
  def previously_guarded?
38
44
  @serializer.field_condition_blocks[@name]
39
45
  end
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.2.37"
2
+ VERSION = "1.2.38"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.37
4
+ version: 1.2.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-20 00:00:00.000000000 Z
11
+ date: 2021-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable