paramore 3.6.2 → 3.7.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: fca99d33c8a3b32eb98a7d4594ca566d7a5c2a114b4c6b29b3d5067416760739
4
- data.tar.gz: e42a6eb5ddb69906005d91ff8e22aa0928062c01e9e00ce7a6b4d50599d4c18e
3
+ metadata.gz: 8f4d632e13e525b85eacf0f3c67c7123d998d488785e484bb7ab200f436ba9dc
4
+ data.tar.gz: 9421b6ac0f62e255d00039ecefd5652c75a29bb740bf51695d543d635a9d3a6f
5
5
  SHA512:
6
- metadata.gz: e64d230fa1408afe666295e454431aeef715d9a4fdcdc9a3284feff7bd5b57a1da33a9455d6179f9da14d65c6a09c3aa39d82ff066947bf172df5d42424bac1b
7
- data.tar.gz: d179870cc3a1eb6013bebbf12868a4d377228d0c62899c17886cbf5d08809aa96704da6f888473989cd39e7091bc36e306464f0fce5f331bcec0d1b0f0baf38d
6
+ metadata.gz: 65bcb1cf925f83ed2ceb4b3364451aa9ff2af396843427a09ece8e07beee85722420b69c651d7a52ae9c03b7a8aec7e03bca509f9cd8772c4aadded9550fec0f
7
+ data.tar.gz: 3b7ed7bd42edd6a700a41ed37670c3da207b4ab18455fc842beb374e59bbb9b403c2d26809e36be6272d475b5ce3707d930f390aa172fda4018d94fafd7b2766
@@ -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
 
@@ -53,7 +53,23 @@ module Paramore
53
53
  module Date
54
54
  module_function
55
55
  def [](input)
56
- Date.parse(input)
56
+ ::Date.parse(input)
57
+ end
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
57
73
  end
58
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.2
4
+ version: 3.7.1
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-05 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.2 !
118
+ Thank you for installing Paramore 3.7.1 !
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