active_serialize 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 367ae37d7d28d38e8b6ad1a449590ddb72b42a94
4
- data.tar.gz: 527f9f6c0bbbb718aa4c88229088237918429465
3
+ metadata.gz: f0a81eb1f2145ece2d057636e2021baad5dd37c7
4
+ data.tar.gz: 4bb5c2a4768d42f7f4eee7475c66c7e7d0e99085
5
5
  SHA512:
6
- metadata.gz: 0cea92163449a43f483e950a4df97bafbdcd351a2851cfe0cec9be18f6d7a18fc8c258e2f595d656ca65b170f61647b8ffbfc40bd1fd33973cd1d9f509643622
7
- data.tar.gz: 2b9c1d407792742d64270a95c79bdda36690c5605cf3d00e05a2e80465ab644df05b8470cf67969ae56967435ba24087a6e33b69fd0a1673a415b004f7b000c8
6
+ metadata.gz: b7ecff72c8e297875b1f305039d8ea2e99ea42180075242e7a91a0b7b030624e2105c50617904648636d2c9c6d6b190f2ed307277dd9b1b37959fe260563195f
7
+ data.tar.gz: 58abc1ca68a47f01d1e790aacdf4076e5bfa8700572f640a7e42edf9ac521c26476b2bb29514db4c9b0613554f3fa460cb28fa3973c67149152942802ec13705
@@ -35,12 +35,10 @@ module ActiveSerialize
35
35
  recursion = (_active_serialize[:recursive] + recursive).map { |k| [ k, public_send(k)&.to_ha(*groups) ] }.to_h
36
36
  merge.merge!(flat_add.map(&method(:public_send)).reduce({ }, :merge)) if flat_add.present?
37
37
  keys = active_serialize_keys(*groups, rmv: rmv, add: add, **opts)
38
- if keys.is_a?(Hash) && instance_exec(&keys[:if].first)
39
- keys = keys[:if].last[:only] ||
40
- keys[:normal] + (keys[:if].last[:add] || [ ]) - (keys[:if].last[:rmv] || [ ])
41
- else
42
- keys = keys[:normal]
43
- end
38
+ instance_exec(&keys[:if].first) \
39
+ ? keys[:if].last[:only] || keys[:normal] + (keys[:if].last[:add] || [ ]) - (keys[:if].last[:rmv] || [ ])
40
+ : keys[:normal] \
41
+ if keys.is_a?(Hash)
44
42
 
45
43
  KeyFormatter.(_active_serialize[:key_format],
46
44
  keys.map { |key| [ key, public_send(key) ] }.to_h
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveSerialize
4
- VERSION = '2.5.0'
4
+ VERSION = '2.5.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_serialize
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhandao