Module: Browser::Platform
- Included in:
- Browser
- Defined in:
- lib/browser/methods/platform.rb
Instance Method Summary collapse
-
#android? ⇒ Boolean
Detect if browser is Android.
-
#ios4? ⇒ Boolean
Detect if is iOS5.
-
#ios5? ⇒ Boolean
Detect if is iOS5.
-
#ios6? ⇒ Boolean
Detect if is iOS6.
-
#ios7? ⇒ Boolean
Detect if is iOS7.
-
#ios? ⇒ Boolean
Detect if browser is ios?.
-
#linux? ⇒ Boolean
Detect if current platform is Linux flavor.
-
#mac? ⇒ Boolean
Detect if current platform is Macintosh.
-
#platform ⇒ Object
Return the platform.
- #windows8? ⇒ Boolean
-
#windows? ⇒ Boolean
Detect if current platform is Windows.
-
#windows_mobile? ⇒ Boolean
Detect if current platform is Windows Mobile.
-
#windows_phone? ⇒ Boolean
Detect if current platform is Windows Phone.
- #windows_rt? ⇒ Boolean
Instance Method Details
#android? ⇒ Boolean
Detect if browser is Android.
4 5 6 |
# File 'lib/browser/methods/platform.rb', line 4 def android? !!(ua =~ /Android/ && !opera?) end |
#ios4? ⇒ Boolean
Detect if is iOS5.
14 15 16 |
# File 'lib/browser/methods/platform.rb', line 14 def ios4? ios? && !!(ua =~ /OS 4/) end |
#ios5? ⇒ Boolean
Detect if is iOS5.
19 20 21 |
# File 'lib/browser/methods/platform.rb', line 19 def ios5? ios? && !!(ua =~ /OS 5/) end |
#ios6? ⇒ Boolean
Detect if is iOS6.
24 25 26 |
# File 'lib/browser/methods/platform.rb', line 24 def ios6? ios? && !!(ua =~ /OS 6/) end |
#ios7? ⇒ Boolean
Detect if is iOS7.
29 30 31 |
# File 'lib/browser/methods/platform.rb', line 29 def ios7? ios? && !!(ua =~ /OS 7/) end |
#ios? ⇒ Boolean
Detect if browser is ios?.
9 10 11 |
# File 'lib/browser/methods/platform.rb', line 9 def ios? ipod? || ipad? || iphone? end |
#linux? ⇒ Boolean
Detect if current platform is Linux flavor.
52 53 54 |
# File 'lib/browser/methods/platform.rb', line 52 def linux? !!(ua =~ /Linux/) end |
#mac? ⇒ Boolean
Detect if current platform is Macintosh.
34 35 36 |
# File 'lib/browser/methods/platform.rb', line 34 def mac? !!(ua =~ /Mac OS X/) end |
#platform ⇒ Object
Return the platform.
67 68 69 70 71 72 73 74 75 |
# File 'lib/browser/methods/platform.rb', line 67 def platform case when linux? then :linux when mac? then :mac when windows? then :windows else :other end end |
#windows8? ⇒ Boolean
43 44 45 |
# File 'lib/browser/methods/platform.rb', line 43 def windows8? windows? && !!(ua =~ /Windows NT 6.[2-3]/) end |
#windows? ⇒ Boolean
Detect if current platform is Windows.
39 40 41 |
# File 'lib/browser/methods/platform.rb', line 39 def windows? !!(ua =~ /Windows/) end |
#windows_mobile? ⇒ Boolean
Detect if current platform is Windows Mobile.
57 58 59 |
# File 'lib/browser/methods/platform.rb', line 57 def windows_mobile? !!(ua =~ /Windows CE/) end |
#windows_phone? ⇒ Boolean
Detect if current platform is Windows Phone.
62 63 64 |
# File 'lib/browser/methods/platform.rb', line 62 def windows_phone? !!(ua =~ /Windows Phone/) end |
#windows_rt? ⇒ Boolean
47 48 49 |
# File 'lib/browser/methods/platform.rb', line 47 def windows_rt? windows8? && !!(ua =~ /ARM/) end |