paramore 3.6.3 → 3.8.0

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: e733dfa7ee459ddb6414dd08d445849699d018c2a48d1f2e0b2f2931175b129b
4
- data.tar.gz: ca5be42b9ea963be8af195748f1fc34979fbbc0b78ee0f5cb9894b67ab98086e
3
+ metadata.gz: c3bb9a50f6bb63dc53c88d85e39689b00ef649e0a025cef6819499b38eceed03
4
+ data.tar.gz: f2b156953e944825ebf6f4a9952b777ad35bbda553354d9ffcb9dcc0cfc6d6b6
5
5
  SHA512:
6
- metadata.gz: ae3f9d54ff493f62b2b6ca3ab8b6d091649123b91f0eaba6f5c3176785bd829576ecea2fdd7a6302e30f778c9119c9719f3d8e6bad4674619baf1bf03316b5e8
7
- data.tar.gz: dc4d963d8e24f838419647f4a7cf2c2591466844d7dc89f99f69ffbb1d0726e2d659101b1f5f9399dcfef762ff3231b1bd3c756ecd37cfe3b1bac1be6f20317b
6
+ metadata.gz: 7c587bfe07b88eaa6fa15cfba9b901feaa39c19b95a37f0c930b4074e38c0f8b8321b08a25e25dcf57df7e73b53a3b9d76eaf4a61861d7d9c6f2afa710a6832f
7
+ data.tar.gz: 6cded21a8fd8dad5ef7a0b26fc9faed8b9ac046a3a46ee85ac5f950ccb406a500a5c66fce564956978a12f11a02c7ad1148fdeb3a9a09097fe931dcdf8d85221
@@ -23,7 +23,7 @@ module Paramore
23
23
  typecast_array(field, value, name)
24
24
  else
25
25
  if value == '' && !field.allow_empty? && field.nullable?
26
- nil
26
+ field.default? ? field.default : nil
27
27
  else
28
28
  typecast_value(field.type, value, name)
29
29
  end
@@ -54,9 +54,11 @@ module Paramore
54
54
  def typecast_array(field, array, name)
55
55
  raise Paramore::ArrayExpected.new(name, array) unless array.is_a?(Array)
56
56
 
57
- array
57
+ result = array
58
58
  .reject { |unit| unit.to_s == '' && field.compact? }
59
59
  .map { |unit| cast(Paramore.field(field.type.first, null: true), unit) }
60
+
61
+ field.compact? ? result.compact : result
60
62
  end
61
63
 
62
64
  def typecast_value(type, value, name)
@@ -6,7 +6,7 @@ module Paramore
6
6
  null: false,
7
7
  compact: false,
8
8
  default: nil,
9
- empty: true,
9
+ empty: false,
10
10
  required: true,
11
11
  }.freeze
12
12
 
@@ -56,4 +56,20 @@ module Paramore
56
56
  ::Date.parse(input)
57
57
  end
58
58
  end
59
+
60
+ module File
61
+ VALID_CLASSES = [
62
+ File,
63
+ StringIO,
64
+ Rack::Test::UploadedFile,
65
+ ActionDispatch::Http::UploadedFile,
66
+ ].freeze
67
+
68
+ module_function
69
+ def [](input)
70
+ raise "#{input.class} is not a file!" unless input.class.in?(VALID_CLASSES)
71
+
72
+ input
73
+ end
74
+ end
59
75
  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.6.3
4
+ version: 3.8.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-29 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails
@@ -115,7 +115,7 @@ licenses:
115
115
  - MIT
116
116
  metadata: {}
117
117
  post_install_message: |
118
- Thank you for installing Paramore 3.6.3 !
118
+ Thank you for installing Paramore 3.8.0 !
119
119
  From the command line you can run `paramore` to generate a configuration file
120
120
 
121
121
  More details here : https://github.com/lumzdas/paramore/blob/master/README.md