class Sinatra::Base
def route(verb, path, opts={}, &block)
def route(verb, path, opts={}, &block) host_name opts[:host] if opts.key?(:host) user_agent opts[:agent] if opts.key?(:agent) accept_mime_types opts[:provides] if opts.key?(:provides) pattern, keys = compile(path) conditions, @conditions = @conditions, [] define_method "#{verb} #{path}", &block unbound_method = instance_method("#{verb} #{path}") block = lambda { unbound_method.bind(self).call } (routes[verb] ||= []). push([pattern, keys, conditions, block]).last end