Permalink
Browse files

fix decomplie

  • Loading branch information...
1 parent 639acf8 commit fa76fb051094192923b574cb6a27385b78bb7f1c @rkh committed Apr 5, 2013
Showing with 12 additions and 11 deletions.
  1. +8 −8 Gemfile.lock
  2. +4 −3 lib/sinatra/decompile.rb
View
@@ -1,8 +1,8 @@
GIT
remote: git://github.com/sinatra/sinatra
- revision: 9567316944fd03489b93f4e8a4072a2e4932e007
+ revision: ccbf20272ab516fda7c51a93344c8a46eb2f8b8f
specs:
- sinatra (1.4.1)
+ sinatra (1.4.2)
rack (~> 1.5, >= 1.5.2)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
@@ -21,20 +21,20 @@ PATH
GEM
remote: http://rubygems.org/
specs:
- backports (3.1.1)
- diff-lcs (1.2.1)
+ backports (3.3.0)
+ diff-lcs (1.2.2)
erubis (2.7.0)
eventmachine (1.0.3)
- haml (4.0.0)
+ haml (4.0.1)
tilt
json (1.7.7)
- multi_json (1.6.1)
+ multi_json (1.7.2)
rack (1.5.2)
rack-protection (1.5.0)
rack
rack-test (0.6.2)
rack (>= 1.0)
- rake (10.0.3)
+ rake (10.0.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
@@ -47,7 +47,7 @@ GEM
temple (~> 0.5.5)
tilt (~> 1.3.3)
temple (0.5.5)
- tilt (1.3.5)
+ tilt (1.3.6)
yajl-ruby (1.1.0)
PLATFORMS
View
@@ -78,8 +78,9 @@ def decompile(pattern, keys = nil, *)
str.gsub! /^\/(\^|\\A)?|(\$|\\z)?\/$/, ''
str.gsub! encoded(' '), ' '
return pattern if str =~ /^[\.\+]/
- capture = '((?:[^\.\/?#%]|(?:%[^2].|%[2][^Ee]))+)'
- str.gsub! /\([^\(\)]*\)|\([^\(\)]*\([^\(\)]*\)[^\(\)]*\)|#{Regexp.escape(capture)}/ do |part|
+ str.gsub! '((?:[^\.\/?#%]|(?:%[^2].|%[2][^Ee]))+)', '([^\/?#]+)'
+ str.gsub! '((?:[^\/?#%]|(?:%[^2].|%[2][^Ee]))+)', '([^\/?#]+)'
+ str.gsub! /\([^\(\)]*\)|\([^\(\)]*\([^\(\)]*\)[^\(\)]*\)/ do |part|
case part
when '(.*?)'
return pattern if keys.shift != 'splat'
@@ -88,7 +89,7 @@ def decompile(pattern, keys = nil, *)
$1
when /^\(\?\:(%\d+)\|([^\)]+|\([^\)]+\))\)$/
URI.unescape($1)
- when '([^\/?#]+)', capture
+ when '([^\/?#]+)'
return pattern if keys.empty?
":" << keys.shift
when /^\(\?\:\\?(.)\|/

0 comments on commit fa76fb0

Please sign in to comment.