roda 3.98.0 → 3.99.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/lib/roda/plugins/run_require_slash.rb +3 -3
- data/lib/roda/request.rb +18 -0
- data/lib/roda/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26619fe3a0b256c2615c6be17f215919c73a804609f536a3ff9f8329f14e7f9b
|
|
4
|
+
data.tar.gz: 550f978b06bf82356bcbefedc9d00929073549c02cb118362212527f52a6336d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 244665571cdb2b400ced6494ab8210fbf12ab46b2fd799f35fd7373f675606c975b8fc7cc6a279532c8b76d9a981a339528b41567d022d353f763ee8028b4225
|
|
7
|
+
data.tar.gz: a30c5c61b21ff9c65c0cfdad17a1011039d44b57c498e7e833fec859a7ec6876d593eb53b950c56d6b7a8858f11e6e2edf6d3798db2288ccfa5b965be019bbe5
|
|
@@ -9,7 +9,7 @@ class Roda
|
|
|
9
9
|
# dispatching to the application with an environment that would violate the
|
|
10
10
|
# Rack SPEC.
|
|
11
11
|
#
|
|
12
|
-
# You are unlikely to want to use this plugin unless are consuming partial
|
|
12
|
+
# You are unlikely to want to use this plugin unless you are consuming partial
|
|
13
13
|
# segments of the request path, or using the match_affix plugin to change
|
|
14
14
|
# how routing is done:
|
|
15
15
|
#
|
|
@@ -23,10 +23,10 @@ class Roda
|
|
|
23
23
|
# end
|
|
24
24
|
#
|
|
25
25
|
# # with run_require_slash:
|
|
26
|
-
# # GET /a/b/e =>
|
|
26
|
+
# # GET /a/b/e => Not dispatched to application
|
|
27
27
|
# # GET /a/b => App gets "" as PATH_INFO
|
|
28
28
|
#
|
|
29
|
-
# #
|
|
29
|
+
# # without run_require_slash:
|
|
30
30
|
# # GET /a/b/e => App gets "e" as PATH_INFO, violating rack SPEC
|
|
31
31
|
# # GET /a/b => App gets "" as PATH_INFO
|
|
32
32
|
module RunRequireSlash
|
data/lib/roda/request.rb
CHANGED
|
@@ -12,6 +12,7 @@ else
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
require 'set'
|
|
15
16
|
require_relative "cache"
|
|
16
17
|
|
|
17
18
|
class Roda
|
|
@@ -489,6 +490,21 @@ class Roda
|
|
|
489
490
|
end
|
|
490
491
|
end
|
|
491
492
|
|
|
493
|
+
# Match only if the next segment in the path is one of the
|
|
494
|
+
# set's elements, and yield the next segment.
|
|
495
|
+
def _match_set(set)
|
|
496
|
+
rp = @remaining_path
|
|
497
|
+
if key = _match_class_String
|
|
498
|
+
if set.include?(@captures[-1])
|
|
499
|
+
true
|
|
500
|
+
else
|
|
501
|
+
@remaining_path = rp
|
|
502
|
+
@captures.pop
|
|
503
|
+
false
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
end
|
|
507
|
+
|
|
492
508
|
# Match the given symbol if any segment matches.
|
|
493
509
|
def _match_symbol(sym=nil)
|
|
494
510
|
rp = @remaining_path
|
|
@@ -629,6 +645,8 @@ class Roda
|
|
|
629
645
|
_match_array(matcher)
|
|
630
646
|
when Hash
|
|
631
647
|
_match_hash(matcher)
|
|
648
|
+
when Set
|
|
649
|
+
_match_set(matcher)
|
|
632
650
|
when Symbol
|
|
633
651
|
_match_symbol(matcher)
|
|
634
652
|
when false, nil
|
data/lib/roda/version.rb
CHANGED