active_serialize 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_serialize.rb +4 -6
- data/lib/active_serialize/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0a81eb1f2145ece2d057636e2021baad5dd37c7
|
4
|
+
data.tar.gz: 4bb5c2a4768d42f7f4eee7475c66c7e7d0e99085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7ecff72c8e297875b1f305039d8ea2e99ea42180075242e7a91a0b7b030624e2105c50617904648636d2c9c6d6b190f2ed307277dd9b1b37959fe260563195f
|
7
|
+
data.tar.gz: 58abc1ca68a47f01d1e790aacdf4076e5bfa8700572f640a7e42edf9ac521c26476b2bb29514db4c9b0613554f3fa460cb28fa3973c67149152942802ec13705
|
data/lib/active_serialize.rb
CHANGED
@@ -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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|