lib/divining_rod/matchers.rb in divining_rod-0.4.0 vs lib/divining_rod/matchers.rb in divining_rod-0.5.0

- old
+ new

@@ -1,23 +1,31 @@ module DiviningRod class Matchers class << self - + def ua(pattern, opts = {}) Definition.new(opts) { |request| - if pattern.match(request.user_agent) + if pattern.match(request.env['HTTP_USER_AGENT']) true end } end - + def subdomain(pattern, opts={}) Definition.new(opts) { |request| - if pattern.match(request.subdomains[0]) + if pattern.match(DiviningRod::Utilities.parse_subdomain(request)[0]) true end } end - + + def ua_prof(pattern, opts ={}) + Definition.new(opts) {|request| + if pattern.match(request.env['X_WAP_PROFILE']) + true + end + } + end + end end end