class Sinatra::Base

def process_route(pattern, conditions, block = nil, values = [])

Returns pass block.

Revert params afterwards.
with keys and call the given block.
If the current request matches pattern and conditions, fill params
def process_route(pattern, conditions, block = nil, values = [])
  route = @request.path_info
  route = '/' if route.empty? and not settings.empty_path_info?
  return unless params = pattern.params(route)
  params.delete("ignore") # TODO: better params handling, maybe turn it into "smart" object or detect changes
  original, @params = @params, @params.merge(params) if params.any?
  if pattern.is_a? Mustermann::Regular
    captures           = pattern.match(route).captures
    values            += captures
    @params[:captures] = captures
  else
    values += params.values.flatten
  end
  catch(:pass) do
    conditions.each { |c| throw :pass if c.bind(self).call == false }
    block ? block[self, values] : yield(self, values)
  end
rescue
  @env['sinatra.error.params'] = @params
  raise
ensure
  @params = original if original
end