tramway 0.4.2 → 0.4.2.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
  SHA256:
3
- metadata.gz: 9c08642e343cc49c4a282e4b8ae7741c9ecce0aa1aeaf2c345cfe1bd4c1770e4
4
- data.tar.gz: 5e077f0ddad19fad81e7b575a473958d0ecbadf48914a37ee6885775538a7880
3
+ metadata.gz: 7bb8dbca08d937d974bc05f689c007bbc1097f0c88f152f30a1f9028f0872d85
4
+ data.tar.gz: 893f755c940c1c065df7e661d81504224c735a5122214b15de94580e13158c0a
5
5
  SHA512:
6
- metadata.gz: 0106dd32bbd48209be6aae488811d589266b5c485bb05bd4da483bf757bc9469933820472445c0fdd807d9c7cde21edf5e36db5a83f9f61dbbc38fbe5d523855
7
- data.tar.gz: 1f534e4b5bc44dd6f532897042cd53d6385c1e55578281fe10172235ca5695dfa5f5acb2b5dc14849946f47256e5eda69f375f6d0e54163e7d2f291aa9f4f83c
6
+ metadata.gz: d2d42d7487bcdb046930721a626addb3a3e58099351f9ddc806075afec669d0b093674a123a554436ff4a0a078c7ee1eeb756e0cd9fed9e55ff87484813dbd15
7
+ data.tar.gz: 0fe247ddb06976ac7e8f1b5ddb1efe360e50b5902c6d60e81d6d009aa341033a07561dd9c41a5156de723c46e5986799931014b5c9200d2f5cc04624759cf20e
@@ -37,10 +37,12 @@ module Tramway
37
37
  base.extend ClassMethods
38
38
  end
39
39
 
40
+ # :reek:NilCheck { enabled: false }
40
41
  def __apply_normalizations(params)
41
42
  self.class.normalizations.reduce(params) do |hash, (attribute, normalization)|
42
- if hash.key?(attribute) || normalization[:apply_to_nil]
43
- hash.merge(attribute => instance_exec(hash[attribute], &normalization[:proc]))
43
+ value = hash[attribute]
44
+ if hash.key?(attribute) && (!value.nil? || normalization[:apply_to_nil])
45
+ hash.merge(attribute => instance_exec(value, &normalization[:proc]))
44
46
  else
45
47
  hash
46
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-02-21 00:00:00.000000000 Z
12
+ date: 2024-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-struct