# File 'lib/sinatra/decompile.rb', line 70defdecompile(pattern,keys=nil,*)# Everything in here is basically just the reverse of# Sinatra::Base#compile## Sinatra 2.0 will come with a mechanism for this, making this obsolete.pattern,keys=patternifpattern.respond_to?:to_arykeys,str=keys.try(:dup),pattern.inspectreturnpatternunlessstr.start_with?'/'andstr.end_with?'/'str.gsub!/^\/(\^|\\A)?|(\$|\\z)?\/$/,''str.gsub!encoded(' '),' 'returnpatternifstr=~/^[\.\+]/str.gsub!'((?:[^\.\/?#%]|(?:%[^2].|%[2][^Ee]))+)','([^\/?#]+)'str.gsub!'((?:[^\/?#%]|(?:%[^2].|%[2][^Ee]))+)','([^\/?#]+)'str.gsub!/\([^\(\)]*\)|\([^\(\)]*\([^\(\)]*\)[^\(\)]*\)/do|part|casepartwhen'(.*?)'returnpatternifkeys.shift!='splat''*'when/^\(\?\:(\\*.)\|%[\w\[\]]+\)$/$1when/^\(\?\:(%\d+)\|([^\)]+|\([^\)]+\))\)$/URI.unescape($1)when'([^\/?#]+)'returnpatternifkeys.empty?":"<<keys.shiftwhen/^\(\?\:\\?(.)\|/char=$1returnpatternunlessencoded(char)==partRegexp.escape(char)elsereturnpatternendendstr.gsub/(.)([\.\+\(\)\/])/doreturnpatternif$1!="\\"$2endend