1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Merge pull request #994 from nico-hn/refactoring_of_compile

refactor Base.compile: modified the handling of special cases
This commit is contained in:
Zachary Scott 2015-05-22 18:07:48 -07:00
commit 1830563b0c

View file

@ -1654,14 +1654,10 @@ module Sinatra
# Special case handling.
#
if segment = segments.pop
if segment.match(/\[\^\\\./)
parts = segment.rpartition(/\[\^\\\./)
if last_segment = segments[-1] and last_segment.match(/\[\^\\\./)
parts = last_segment.rpartition(/\[\^\\\./)
parts[1] = '[^'
segments << parts.join
else
segments << segment
end
segments[-1] = parts.join
end
[/\A#{segments.join('/')}\z/, keys]
elsif path.respond_to?(:keys) && path.respond_to?(:match)