roda 3.38.0 → 3.39.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 +4 -4
- data/CHANGELOG +8 -0
- data/doc/release_notes/3.3.0.txt +1 -1
- data/doc/release_notes/3.39.0.txt +16 -0
- data/lib/roda.rb +6 -0
- data/lib/roda/plugins/default_headers.rb +1 -0
- data/lib/roda/plugins/mail_processor.rb +2 -0
- data/lib/roda/plugins/relative_path.rb +4 -3
- data/lib/roda/plugins/render.rb +1 -1
- data/lib/roda/plugins/type_routing.rb +1 -0
- data/lib/roda/plugins/typecast_params.rb +2 -2
- data/lib/roda/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f01105e24f4eae80a69f5734f93d3dfe54b5f6be2489521f1d886053c569102
|
|
4
|
+
data.tar.gz: 2aebf30460c7d5352ee15baf3f884e59dac972e0aadd63aa7ab81445a8a29f65
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3fd374b3d700106ca814fff8f2dd0c66a3295955f27a453ef5d9fb2ba7fdea583d76ce82f91efb8e2ebcbb97a07e664f3f008689d51eb67ae39aebdd86a5d0e
|
|
7
|
+
data.tar.gz: 59c34c88ab1e5a5bc5017d46707a530c7cd002f4262c30751ba6429983b32477b813d83ada45a19873be711d1d2bd0abd95fe2a5c44c01038ad4a32dbb8f276d
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
= 3.39.0 (2020-12-15)
|
|
2
|
+
|
|
3
|
+
* Speed up relative_path plugin if relative_path or relative_prefix is called more than once (jeremyevans)
|
|
4
|
+
|
|
5
|
+
* Avoid method redefinition warnings in verbose warning mode (jeremyevans)
|
|
6
|
+
|
|
7
|
+
* Make typecast_params.convert! handle explicit nil values the same as missing values (jeremyevans)
|
|
8
|
+
|
|
1
9
|
= 3.38.0 (2020-11-16)
|
|
2
10
|
|
|
3
11
|
* Make error_email and error_mail plugins rescue invalid parameter errors when preparing the email body (jeremyevans)
|
data/doc/release_notes/3.3.0.txt
CHANGED
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
Note that if there are multiple conversion errors raised inside a
|
|
249
249
|
convert! or convert_each! block, they are recorded and a single
|
|
250
250
|
Roda::RodaPlugins::TypecastParams::Error instance is raised after
|
|
251
|
-
processing the block. TypecastParams::Error#
|
|
251
|
+
processing the block. TypecastParams::Error#param_names can be
|
|
252
252
|
called on the exception to get an array of all parameter names
|
|
253
253
|
with conversion issues, and TypecastParams::Error#all_errors
|
|
254
254
|
can be used to get an array of all Error instances.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
= Improvements
|
|
2
|
+
|
|
3
|
+
* The relative_path plugin is now faster if you are calling
|
|
4
|
+
relative_path or relative_prefix more than once when handling a
|
|
5
|
+
request.
|
|
6
|
+
|
|
7
|
+
* The typecast_params.convert! method in the typecast_params plugin
|
|
8
|
+
now handles explicit nil values the same as missing values.
|
|
9
|
+
Explicit nil values do not generally occur in normal Rack parameter
|
|
10
|
+
parsing, but they can occur when using the json_parser plugin to
|
|
11
|
+
parse JSON requests.
|
|
12
|
+
|
|
13
|
+
* Roda now avoids method redefinition warnings in verbose mode by
|
|
14
|
+
using a self alias. As Ruby 3 is dropping uninitialized instance
|
|
15
|
+
variable warnings, Roda will be verbose warning free if you are
|
|
16
|
+
using Ruby 3.
|
data/lib/roda.rb
CHANGED
|
@@ -114,6 +114,7 @@ class Roda
|
|
|
114
114
|
alias_method meth, temp_method
|
|
115
115
|
undef_method temp_method
|
|
116
116
|
private meth
|
|
117
|
+
alias_method meth, meth
|
|
117
118
|
meth = :"#{meth}_arity"
|
|
118
119
|
elsif required_args > 1
|
|
119
120
|
b = block
|
|
@@ -144,6 +145,7 @@ class Roda
|
|
|
144
145
|
|
|
145
146
|
define_method(meth, &block)
|
|
146
147
|
private meth
|
|
148
|
+
alias_method meth, meth
|
|
147
149
|
|
|
148
150
|
if arity_meth
|
|
149
151
|
required_args, optional_args, rest, keyword = _define_roda_method_arg_numbers(instance_method(meth))
|
|
@@ -167,6 +169,7 @@ class Roda
|
|
|
167
169
|
send(meth, *a)
|
|
168
170
|
end
|
|
169
171
|
private arity_meth
|
|
172
|
+
alias_method arity_meth, arity_meth
|
|
170
173
|
end
|
|
171
174
|
|
|
172
175
|
call_meth
|
|
@@ -199,6 +202,7 @@ class Roda
|
|
|
199
202
|
|
|
200
203
|
private
|
|
201
204
|
|
|
205
|
+
alias set_default_headers set_default_headers
|
|
202
206
|
def set_default_headers
|
|
203
207
|
@headers['Content-Type'] ||= 'text/html'
|
|
204
208
|
end
|
|
@@ -403,6 +407,7 @@ class Roda
|
|
|
403
407
|
class_eval("def _roda_before; #{meths.join(';')} end", __FILE__, __LINE__)
|
|
404
408
|
end
|
|
405
409
|
private :_roda_before
|
|
410
|
+
alias_method :_roda_before, :_roda_before
|
|
406
411
|
end
|
|
407
412
|
end
|
|
408
413
|
|
|
@@ -419,6 +424,7 @@ class Roda
|
|
|
419
424
|
class_eval("def _roda_after(res); #{meths.map{|s| "#{s}(res)"}.join(';')} end", __FILE__, __LINE__)
|
|
420
425
|
end
|
|
421
426
|
private :_roda_after
|
|
427
|
+
alias_method :_roda_after, :_roda_after
|
|
422
428
|
end
|
|
423
429
|
end
|
|
424
430
|
|
|
@@ -41,6 +41,7 @@ class Roda
|
|
|
41
41
|
# Return a relative prefix to append to an absolute path to a relative path
|
|
42
42
|
# based on the current path of the request.
|
|
43
43
|
def relative_prefix
|
|
44
|
+
return @_relative_prefix if @_relative_prefix
|
|
44
45
|
env = @_request.env
|
|
45
46
|
script_name = env["SCRIPT_NAME"]
|
|
46
47
|
path_info = env["PATH_INFO"]
|
|
@@ -50,16 +51,16 @@ class Roda
|
|
|
50
51
|
case script_name.getbyte(0)
|
|
51
52
|
when nil # SCRIPT_NAME empty
|
|
52
53
|
unless path_info.getbyte(0) == 47 # PATH_INFO starts with /
|
|
53
|
-
return ''
|
|
54
|
+
return(@_relative_prefix = '')
|
|
54
55
|
end
|
|
55
56
|
when 47 # SCRIPT_NAME starts with /
|
|
56
57
|
# nothing
|
|
57
58
|
else
|
|
58
|
-
return ''
|
|
59
|
+
return(@_relative_prefix = '')
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
slash_count = script_name.count('/') + path_info.count('/')
|
|
62
|
-
if slash_count > 1
|
|
63
|
+
@_relative_prefix = if slash_count > 1
|
|
63
64
|
("../" * (slash_count - 2)) << ".."
|
|
64
65
|
else
|
|
65
66
|
"."
|
data/lib/roda/plugins/render.rb
CHANGED
|
@@ -106,7 +106,7 @@ class Roda
|
|
|
106
106
|
# :template_block :: Pass this block when creating the underlying template,
|
|
107
107
|
# ignored when using :inline. Disables caching of the
|
|
108
108
|
# template by default.
|
|
109
|
-
# :template_class :: Provides the template class to use,
|
|
109
|
+
# :template_class :: Provides the template class to use, instead of using
|
|
110
110
|
# Tilt or <tt>Tilt[:engine]</tt>.
|
|
111
111
|
#
|
|
112
112
|
# Here's an example of using these options:
|
|
@@ -229,7 +229,7 @@ class Roda
|
|
|
229
229
|
#
|
|
230
230
|
# Note that if there are multiple conversion Error raised inside a +convert!+ or +convert_each!+
|
|
231
231
|
# block, they are recorded and a single TypecastParams::Error instance is raised after
|
|
232
|
-
# processing the block. TypecastParams::Error#
|
|
232
|
+
# processing the block. TypecastParams::Error#param_names can be called on the exception to
|
|
233
233
|
# get an array of all parameter names with conversion issues, and TypecastParams::Error#all_errors
|
|
234
234
|
# can be used to get an array of all Error instances.
|
|
235
235
|
#
|
|
@@ -724,7 +724,7 @@ class Roda
|
|
|
724
724
|
raise Error, "parameter #{param_name(nil)} is not a hash" if do_raise
|
|
725
725
|
return
|
|
726
726
|
end
|
|
727
|
-
present =
|
|
727
|
+
present = !@obj[key].nil?
|
|
728
728
|
when Integer
|
|
729
729
|
unless @obj.is_a?(Array)
|
|
730
730
|
raise Error, "parameter #{param_name(nil)} is not an array" if do_raise
|
data/lib/roda/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roda
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.39.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Evans
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|
|
@@ -214,6 +214,7 @@ extra_rdoc_files:
|
|
|
214
214
|
- doc/release_notes/3.36.0.txt
|
|
215
215
|
- doc/release_notes/3.37.0.txt
|
|
216
216
|
- doc/release_notes/3.38.0.txt
|
|
217
|
+
- doc/release_notes/3.39.0.txt
|
|
217
218
|
files:
|
|
218
219
|
- CHANGELOG
|
|
219
220
|
- MIT-LICENSE
|
|
@@ -253,6 +254,7 @@ files:
|
|
|
253
254
|
- doc/release_notes/3.36.0.txt
|
|
254
255
|
- doc/release_notes/3.37.0.txt
|
|
255
256
|
- doc/release_notes/3.38.0.txt
|
|
257
|
+
- doc/release_notes/3.39.0.txt
|
|
256
258
|
- doc/release_notes/3.4.0.txt
|
|
257
259
|
- doc/release_notes/3.5.0.txt
|
|
258
260
|
- doc/release_notes/3.6.0.txt
|