class Sinatra::Base
def user_agent(pattern)
Condition for matching user agent. Parameter should be Regexp.
def user_agent(pattern) condition do if request.user_agent =~ pattern @params[:agent] = $~[1..-1] true else false end end end
def user_agent(pattern) condition do if request.user_agent =~ pattern @params[:agent] = $~[1..-1] true else false end end end