Module: Browser::Devices
- Included in:
- Browser
- Defined in:
- lib/browser/methods/devices.rb
Instance Method Summary collapse
-
#ipad? ⇒ Boolean
Detect if browser is iPad.
-
#iphone? ⇒ Boolean
Detect if browser is iPhone.
-
#ipod? ⇒ Boolean
Detect if browser is iPod.
-
#kindle? ⇒ Boolean
Detect if browser is Kindle.
-
#playbook? ⇒ Boolean
Detect if browser if a Blackberry Playbook tablet.
- #surface? ⇒ Boolean
-
#tablet? ⇒ Boolean
Detect if browser is tablet (currently iPad, Android, Surface or Playbook).
- #windows_touchscreen_desktop? ⇒ Boolean
Instance Method Details
#ipad? ⇒ Boolean
Detect if browser is iPad.
9 10 11 |
# File 'lib/browser/methods/devices.rb', line 9 def ipad? !!(ua =~ /iPad/) end |
#iphone? ⇒ Boolean
Detect if browser is iPhone.
4 5 6 |
# File 'lib/browser/methods/devices.rb', line 4 def iphone? !!(ua =~ /iPhone/) end |
#ipod? ⇒ Boolean
Detect if browser is iPod.
14 15 16 |
# File 'lib/browser/methods/devices.rb', line 14 def ipod? !!(ua =~ /iPod/) end |
#kindle? ⇒ Boolean
Detect if browser is Kindle.
28 29 30 |
# File 'lib/browser/methods/devices.rb', line 28 def kindle? !!(ua =~ /Kindle/ || silk?) end |
#playbook? ⇒ Boolean
Detect if browser if a Blackberry Playbook tablet
33 34 35 |
# File 'lib/browser/methods/devices.rb', line 33 def playbook? !!(ua =~ /PlayBook/ && ua =~ /RIM Tablet/) end |
#surface? ⇒ Boolean
18 19 20 |
# File 'lib/browser/methods/devices.rb', line 18 def surface? windows_rt? && !!(ua =~ /Touch/) end |
#tablet? ⇒ Boolean
Detect if browser is tablet (currently iPad, Android, Surface or Playbook).
23 24 25 |
# File 'lib/browser/methods/devices.rb', line 23 def tablet? !!(ipad? || (android? && !detect_mobile?) || surface? || playbook?) end |
#windows_touchscreen_desktop? ⇒ Boolean
37 38 39 |
# File 'lib/browser/methods/devices.rb', line 37 def windows_touchscreen_desktop? windows? && !!(ua =~ /Touch/) end |