class Sinatra::Base

def compile(path)

def compile(path)
  keys = []
  if path.respond_to? :to_str
    pattern =
      URI.encode(path).gsub(/((:\w+)|\*)/) do |match|
        if match == "*"
          keys << 'splat'
          "(.*?)"
        else
          keys << $2[1..-1]
          "([^/?&#\.]+)"
        end
      end
    [/^#{pattern}$/, keys]
  elsif path.respond_to? :=~
    [path, keys]
  else
    raise TypeError, path
  end
end