sinatra-wanted 0.8.2 → 0.8.4
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 +4 -4
- data/lib/sinatra/helpers/wanted/version.rb +1 -1
- data/lib/sinatra/helpers/wanted.rb +19 -4
- data/sinatra-wanted.gemspec +1 -5
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9101f145fd635df26d860b131adc7d6fbe0f1196d228016dbd010c52bb939a33
|
4
|
+
data.tar.gz: b859f5eec52397e2ac3b7dde629f0fe2e9c78d28a3fe2ed452da9c8755ef69a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3172c6004a66b9065ddbd488e9e1f96ee1b402cc1c0764901197401490a679324226ba9a800e7ead3ae4d9096eb318675dc88414aad75c0135f34ec87c061fd0
|
7
|
+
data.tar.gz: 851153cad21081aa85292ce156fa6e4ae17bbde52f4a4503c8a56c04406faf6c5cbb2dc68f9b8e745565a415f547a35c26a23c49adb7a5db2b44b6922fd361dc
|
@@ -11,6 +11,9 @@ module Sinatra::Helpers::Wanted
|
|
11
11
|
end
|
12
12
|
}.freeze
|
13
13
|
|
14
|
+
# List of exception that should be deal as Not Found
|
15
|
+
NotFoundList = []
|
16
|
+
|
14
17
|
# Generic exception.
|
15
18
|
# Only the inherited exceptions are raised.
|
16
19
|
class WantedError < StandardError
|
@@ -110,8 +113,11 @@ module Sinatra::Helpers::Wanted
|
|
110
113
|
end
|
111
114
|
value, id = if param.kind_of?(Symbol)
|
112
115
|
if params.include?(param)
|
113
|
-
then
|
114
|
-
|
116
|
+
then
|
117
|
+
v = params[param]
|
118
|
+
[ v.nil? ? NO_VALUE : v, param ]
|
119
|
+
else
|
120
|
+
[ nil, param ]
|
115
121
|
end
|
116
122
|
else
|
117
123
|
[ param, nil ]
|
@@ -141,14 +147,23 @@ module Sinatra::Helpers::Wanted
|
|
141
147
|
value = Dry::Types::Undefined
|
142
148
|
end
|
143
149
|
end
|
144
|
-
|
150
|
+
|
145
151
|
# Build value from various check/conversion
|
146
152
|
if type_method
|
147
153
|
value = type.public_send(type_method, value)
|
148
154
|
end
|
149
155
|
if !value.nil? && get_method
|
150
156
|
val = value
|
151
|
-
value =
|
157
|
+
value = if NotFoundList.empty?
|
158
|
+
getter.public_send(get_method, value)
|
159
|
+
else
|
160
|
+
begin
|
161
|
+
getter.public_send(get_method, value)
|
162
|
+
rescue *NotFoundList
|
163
|
+
nil
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
152
167
|
# Check if we consider it as not found
|
153
168
|
if value.nil?
|
154
169
|
case not_found
|
data/sinatra-wanted.gemspec
CHANGED
@@ -9,13 +9,9 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.description = <<~EOF
|
10
10
|
Ease processing of parameters in Sinatra framework.
|
11
11
|
Integrates well with dry-types, sequel, ...
|
12
|
-
|
13
|
-
Example:
|
14
|
-
want! :user, Dry::Types::String, User
|
15
|
-
want? :expired, Dry::Types::Params::Bool.default(true)
|
16
12
|
EOF
|
17
13
|
|
18
|
-
s.homepage = 'https://
|
14
|
+
s.homepage = 'https://github.com/sdalu/sinatra-wanted'
|
19
15
|
s.license = 'MIT'
|
20
16
|
|
21
17
|
s.authors = [ "Stéphane D'Alu" ]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-wanted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stéphane D'Alu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -55,10 +55,6 @@ dependencies:
|
|
55
55
|
description: |
|
56
56
|
Ease processing of parameters in Sinatra framework.
|
57
57
|
Integrates well with dry-types, sequel, ...
|
58
|
-
|
59
|
-
Example:
|
60
|
-
want! :user, Dry::Types::String, User
|
61
|
-
want? :expired, Dry::Types::Params::Bool.default(true)
|
62
58
|
email:
|
63
59
|
- stephane.dalu@insa-lyon.fr
|
64
60
|
executables: []
|
@@ -69,7 +65,7 @@ files:
|
|
69
65
|
- lib/sinatra/helpers/wanted.rb
|
70
66
|
- lib/sinatra/helpers/wanted/version.rb
|
71
67
|
- sinatra-wanted.gemspec
|
72
|
-
homepage: https://
|
68
|
+
homepage: https://github.com/sdalu/sinatra-wanted
|
73
69
|
licenses:
|
74
70
|
- MIT
|
75
71
|
metadata: {}
|