Sha256: 1faec797c3fdbc84cf8e40bd86cfe5e268aecfb12b7f5925317cb465d01eae49

Contents?: true

Size: 659 Bytes

Versions: 5

Compression:

Stored size: 659 Bytes

Contents

module DiviningRod
  class Matchers
    class << self

      def ua(pattern, opts = {})
        Definition.new(opts) { |request|
          if pattern.match(request.env['HTTP_USER_AGENT'])
            true
          end
        }
      end

      def subdomain(pattern, opts={})
        Definition.new(opts) { |request|
          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['HTTP_X_WAP_PROFILE'])
            true
          end
        }
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
divining_rod-0.6.4 lib/divining_rod/matchers.rb
divining_rod-0.6.3 lib/divining_rod/matchers.rb
divining_rod-0.6.2 lib/divining_rod/matchers.rb
divining_rod-0.6.1 lib/divining_rod/matchers.rb
divining_rod-0.6.0 lib/divining_rod/matchers.rb