paramore 3.1.1 → 3.2.0

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: fb73686fb48a297c559c211476f565f8aba18a2e93a10936b75cacd4eab2bcb2
4
- data.tar.gz: df12fd5715e1c4e3851a1ed2f9748f24cccec9d9ccc817c7b6ba74960370f426
3
+ metadata.gz: b8620a326873694bcc720cd186b9f4998fde3ab3fc102e2cb81b55822accc1e1
4
+ data.tar.gz: '07288ff15f31bb8480fc30662da17cd6aba34617afff96cd488c205b2c4c4660'
5
5
  SHA512:
6
- metadata.gz: 5d7f2e6f52065f18ebb5b7d51577950ceb234db5f5a21fd3a20fdb987066c451da22beda1bc86a4101ad9bfaf4ccf195a38b1281b02c92c4d8cc2d1fa6602958
7
- data.tar.gz: b5dd8ae054488a628c580924cfdfb0355ef063a43eb7e46fe249ae9ecad62a4a80d5603b4eed182d1b69c1d691926c97165c605b11d05eec4b5ed66efbc3cac3
6
+ metadata.gz: 753ede1706d8dc9563bfa8cfad77683586ac319aefd4f84f80b6247d0daa7054710809a4ae24f812196402a83628d0760992ba8f281de79197e9b69cd39f9570
7
+ data.tar.gz: '078b73a5da242dc7fb75d1175232af4d52928d1cd5db1af9366ca2e95fec990c7ec0e37eaf48c3560e8f27f47a351d03bd448589354bd1f335cc3951763702f5'
@@ -22,7 +22,11 @@ module Paramore
22
22
  when Array
23
23
  typecast_array(field, value)
24
24
  else
25
- typecast_value(field.type, value)
25
+ if value == '' && !field.allow_empty? && field.nullable?
26
+ nil
27
+ else
28
+ typecast_value(field.type, value)
29
+ end
26
30
  end
27
31
  end
28
32
 
@@ -4,15 +4,21 @@ module Paramore
4
4
  null: false,
5
5
  compact: false,
6
6
  default: nil,
7
+ empty: true,
7
8
  }.freeze
8
9
 
9
- def initialize(given_type, null:, compact:, default:)
10
+ def initialize(given_type, null:, compact:, default:, empty:)
10
11
  @given_type = given_type
11
12
  @nullable = null
12
13
  @compact = compact
14
+ @allow_empty = empty
13
15
  @default = default
14
16
  end
15
17
 
18
+ def allow_empty?
19
+ @allow_empty
20
+ end
21
+
16
22
  def default
17
23
  @default
18
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paramore
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Kairevičius
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-16 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails
@@ -101,7 +101,7 @@ licenses:
101
101
  - MIT
102
102
  metadata: {}
103
103
  post_install_message: |
104
- Thank you for installing Paramore 3.1.1 !
104
+ Thank you for installing Paramore 3.2.0 !
105
105
  From the command line you can run `paramore` to generate a configuration file
106
106
 
107
107
  More details here : https://github.com/lumzdas/paramore/blob/master/README.md