Sha256: d147506c4f15120665e029f35b660170f84a466f75c040a8c06e8d4c02c3a167

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

DiviningRod::Mappings.define do |map|
    # Android based phones
    map.ua /Android/, :format => :webkit, :name => 'Android', :tags => [:android, :youtube_capable, :google_gears]
    
    # Apple iPhone OS
    map.ua /Apple.*Mobile.*Safari/, :format => :webkit, :tags => [:apple, :iphone_os, :youtube_capable] do |iphone|
      iphone.ua /iPad/, :tags => :ipad, :name => 'iPad'
      iphone.ua /iPod/, :tags => :ipod, :name => 'iPod Touch'
      iphone.ua /iPhone/, :tags => [:iphone], :name => 'iPhone'
    end
    
    #Blackberry, needs more detail here
    map.ua /BlackBerry/, :tags => :blackberry, :name => 'BlackBerry'
    
    # The desktop browsers, we don't set a format on these to let it pass through
    map.with_options :tags => :desktop do |desktop|
      desktop.ua /Chrome/, :tags => :chrome, :name => 'Chrome'
      desktop.ua /Firefox/, :tags => :firefox, :name => 'Firefox'
      desktop.ua /Safari/, :tags => :safari, :name => 'Safari'
      desktop.ua /Opera/, :tags => :opera, :name => 'Opera'
      desktop.ua /MSIE/, :tags => :ie, :name => 'Internet Explorer' do |msie|
        msie.ua /MSIE 6/, :version => 6
        msie.ua /MSIE 7/, :version => 7
        msie.ua /MSIE 8/, :version => 8
      end
    end
    
    # Enable this to forces a default format if unmatched
    # otherwise it will return the request.format
    # map.default :format => :html 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
divining_rod-0.5.0 example_config.rb
divining_rod-0.4.0 example_config.rb