tramway 0.4.2 → 0.4.3

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: 9c08642e343cc49c4a282e4b8ae7741c9ecce0aa1aeaf2c345cfe1bd4c1770e4
4
- data.tar.gz: 5e077f0ddad19fad81e7b575a473958d0ecbadf48914a37ee6885775538a7880
3
+ metadata.gz: cae2dee0a95959ec9a4d2edb886ffd6fbd2ec305770e0ba78f9dc09f04d641ce
4
+ data.tar.gz: e3d287cd49a4b181279aa8574bec79364af8b9c0b240299cddb3f7ae18dfcd55
5
5
  SHA512:
6
- metadata.gz: 0106dd32bbd48209be6aae488811d589266b5c485bb05bd4da483bf757bc9469933820472445c0fdd807d9c7cde21edf5e36db5a83f9f61dbbc38fbe5d523855
7
- data.tar.gz: 1f534e4b5bc44dd6f532897042cd53d6385c1e55578281fe10172235ca5695dfa5f5acb2b5dc14849946f47256e5eda69f375f6d0e54163e7d2f291aa9f4f83c
6
+ metadata.gz: a2cdabe494be288cc8c1d538b727e41cfa0ce2d8d0c49ca8be1561dbc1780e4ba5826be7ee9c9d7c62dff3749b0a94568f747d03d35405c74a22e62b24e210d3
7
+ data.tar.gz: 36b601a82003ea9c623247d57a068b60fb98998265d7d5dc2a9f505c8e8accbf7ba4e7831bf36601fb05e8b952600bd16900c84db7e8fe4b421b408349914ca5
@@ -12,7 +12,7 @@ module Tramway
12
12
 
13
13
  attr_reader :object
14
14
 
15
- %i[model_name to_key to_model errors attributes].each do |method_name|
15
+ %i[model_name to_key to_model errors attributes update destroy].each do |method_name|
16
16
  delegate method_name, to: :object
17
17
  end
18
18
 
@@ -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.3'
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.3
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-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-struct