Sha256: 3c2fcf540a6c722d596839fcbeecdd57259f88f2b0ccbc30037215bb4510db99

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

class Browser
  module Devices
    # Detect if browser is iPhone.
    def iphone?
      in_ua? 'iPhone'
    end

    # Detect if browser is iPad.
    def ipad?
      in_ua? 'iPad'
    end

    # Detect if browser is iPod.
    def ipod?
      in_ua? 'Pod'
    end

    def surface?
      windows_rt? && in_ua?('Touch')
    end

    # Detect if browser is tablet (currently iPad, Android, Surface or Playbook).
    def tablet?
      !!(ipad? || (android? && !detect_mobile?) || surface? || playbook?)
    end

    # Detect if browser is Kindle.
    def kindle?
      in_ua?('Kindle') || silk?
    end

    # Detect if browser if a Blackberry Playbook tablet
    def playbook?
      !!(ua =~ /PlayBook/ && ua =~ /RIM Tablet/)
    end

    def windows_touchscreen_desktop?
      windows? && !!(ua =~ /Touch/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
browser2-1.0.0 lib/browser/methods/devices.rb