webrick-route_servlet 1.2.8 → 1.2.9

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
  SHA1:
3
- metadata.gz: 3daa5a8732ad22ccf5d3fa8de8bbffe66bc4d2a8
4
- data.tar.gz: 55ef5e254e4a9e207ee2bfd1f132e622df21affd
3
+ metadata.gz: 28c27202030d498528554f283d477a4bb1113b2a
4
+ data.tar.gz: 2113772a490ba1735b1fc206da9b47c43240745b
5
5
  SHA512:
6
- metadata.gz: a990d6a1013aad2b4f2b7ee1578bf1361ddda5d881426ef23d015f36067f01f59d132e272c5444ac1fe451185ed98650fae592570dbcc29d753989ae822d0f74
7
- data.tar.gz: 3cd331027c4bc683fcb7631225bb9b5ab5e5fa173094be769617755689d8943a3f5edad21cc51e531dd11847301424fd73b55c32f0568c779e4e439ed13a694f
6
+ metadata.gz: a7c1f897aef431f4d452671a14ccc0c3af2c72a1468c4a9d78b758b81e116d7f6646bccd833204ec426d0c95344ec3ff414e00957d86cfb1aae317a6eb86a810
7
+ data.tar.gz: 91f0b18a85e00d1a3bee469d7030c7ca6d7d0b2281b062b3a2a510f964b72171c6ac65c399d43aae73b701cf7d89de2ae37a8c36bf48cecbbaa162f64d730f40
@@ -148,13 +148,17 @@ module WEBrick
148
148
  unless Regexp===re
149
149
  # normalize slash
150
150
  re = re.to_s.gsub(%r#/{2,}#, "/")
151
+
151
152
  # escape
152
153
  re = re.gsub(/([\.\-?*+\\^$])/, '\\\\\1')
154
+
153
155
  # start end regexp
154
156
  re = re.sub(%r#^/?#, "^/").sub(%r#/?$#, '/?$')
157
+
155
158
  # normalize parentheses
156
159
  re = re.gsub(")", ")?")
157
- # constrain named capture
160
+
161
+ # constrain named capture ':'
158
162
  constraints = request_options[:constraints] || request_options
159
163
  keys = re.scan(%r#:([^/()\.]+)#).map(&:first).sort{|a,b| b.length <=> a.length}
160
164
  keys.each do |key|
@@ -164,6 +168,17 @@ module WEBrick
164
168
  end
165
169
  re = re.gsub(":#{key}", value_re.to_s)
166
170
  end
171
+
172
+ # constrain named capture '*'
173
+ keys = re.scan(%r#\\\*([^/()\.]+)#).map(&:first).sort{|a,b| b.length <=> a.length}
174
+ keys.each do |key|
175
+ value_re = Regexp.new("(?<#{key}>.+?)")
176
+ if constraints.respond_to?(:[]) && Regexp===constraints[key.to_sym]
177
+ value_re = /(?<#{key}>#{constraints[key.to_sym]})/
178
+ end
179
+ re = re.gsub("\\*#{key}", value_re.to_s)
180
+ end
181
+
167
182
  re = Regexp.new(re)
168
183
  end
169
184
  re
@@ -1,5 +1,5 @@
1
1
  module WEBrick
2
2
  module RouteServlet
3
- VERSION = "1.2.8"
3
+ VERSION = "1.2.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webrick-route_servlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya