Sha256: 27a8a2895dc40c512bfb07252e981e0a485add18025d7454df53c683ae9717e3

Contents?: true

Size: 837 Bytes

Versions: 11

Compression:

Stored size: 837 Bytes

Contents

class Browser
  module Devices
    # Detect if browser is iPhone.
    def iphone?
      !!(ua =~ /iPhone/)
    end

    # Detect if browser is iPad.
    def ipad?
      !!(ua =~ /iPad/)
    end

    # Detect if browser is iPod.
    def ipod?
      !!(ua =~ /iPod/)
    end

    def surface?
      windows_rt? && !!(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?
      !!(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

11 entries across 11 versions & 1 rubygems

Version Path
browser-1.1.0 lib/browser/methods/devices.rb
browser-1.0.1 lib/browser/methods/devices.rb
browser-1.0.0 lib/browser/methods/devices.rb
browser-0.9.1 lib/browser/methods/devices.rb
browser-0.9.0 lib/browser/methods/devices.rb
browser-0.8.0 lib/browser/methods/devices.rb
browser-0.7.2 lib/browser/methods/devices.rb
browser-0.7.1 lib/browser/methods/devices.rb
browser-0.7.0 lib/browser/methods/devices.rb
browser-0.6.0 lib/browser/methods/devices.rb
browser-0.5.0 lib/browser/methods/devices.rb