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 +4 -4
- data/lib/paramore/cast_parameters.rb +4 -2
- data/lib/paramore/field.rb +1 -1
- data/lib/paramore/types.rb +16 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3bb9a50f6bb63dc53c88d85e39689b00ef649e0a025cef6819499b38eceed03
|
4
|
+
data.tar.gz: f2b156953e944825ebf6f4a9952b777ad35bbda553354d9ffcb9dcc0cfc6d6b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/paramore/field.rb
CHANGED
data/lib/paramore/types.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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
|