Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def user_agent(pattern)
- condition {
- if request.user_agent =~ pattern
- @params[:agent] = $~[1..-1]
- true
- else
- false
- end
- }
- end
- alias_method :agent, :user_agent
- def get(path, opts={}, &block)
- conditions = @conditions.dup
- route('GET', path, opts, &block)
- @conditions = conditions
- route('HEAD', path, opts, &block)
- end
- def route(verb, path, options={}, &block)
- # Because of self.options.host
- host_name(options.delete(:bind)) if options.key?(:host)
- options.each {|option, args| send(option, *args)}
- pattern, keys = compile(path)
- conditions, @conditions = @conditions, []
- ...
Add Comment
Please, Sign In to add comment