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:
commit
1830563b0c
1 changed files with 4 additions and 8 deletions
|
@ -1654,14 +1654,10 @@ module Sinatra
|
|||
|
||||
# Special case handling.
|
||||
#
|
||||
if segment = segments.pop
|
||||
if segment.match(/\[\^\\\./)
|
||||
parts = segment.rpartition(/\[\^\\\./)
|
||||
parts[1] = '[^'
|
||||
segments << parts.join
|
||||
else
|
||||
segments << segment
|
||||
end
|
||||
if last_segment = segments[-1] and last_segment.match(/\[\^\\\./)
|
||||
parts = last_segment.rpartition(/\[\^\\\./)
|
||||
parts[1] = '[^'
|
||||
segments[-1] = parts.join
|
||||
end
|
||||
[/\A#{segments.join('/')}\z/, keys]
|
||||
elsif path.respond_to?(:keys) && path.respond_to?(:match)
|
||||
|
|
Loading…
Reference in a new issue