Sha256: a6bb639f20e70258e1bd5a945f8003025da457ea7bb8205c6f7016e62e17fc44
Contents?: true
Size: 845 Bytes
Versions: 4
Compression:
Stored size: 845 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 is running from PSP. def psp? !!(ua =~ /PSP/) end # Detect if browser if a Blackberry Playbook tablet def playbook? !!(ua =~ /PlayBook/ and ua =~ /RIM Tablet/) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
browser-0.3.2 | lib/browser/methods/devices.rb |
browser-0.3.1 | lib/browser/methods/devices.rb |
browser-0.3.0 | lib/browser/methods/devices.rb |
browser-0.2.1 | lib/browser/methods/devices.rb |