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.to_s =~ pattern @params[:agent] = $~[1..-1] true else false end end end
def user_agent(pattern) condition do if request.user_agent.to_s =~ pattern @params[:agent] = $~[1..-1] true else false end end end