Class: Browser::Platform::IOS
- Inherits:
-
Base
- Object
- Base
- Browser::Platform::IOS
show all
- Defined in:
- lib/browser/platform/ios.rb
Constant Summary
collapse
- MATCHER =
/(iPhone|iPad|iPod|CriOS)/.freeze
- VERSION_MATCHER =
/OS (?<major>\d+)_(?<minor>\d+)_?(?<patch>\d+)?/.freeze
Instance Attribute Summary
Attributes inherited from Base
#ua
Instance Method Summary
collapse
Methods inherited from Base
#accept_language, #alipay?, #bot, #bot?, #chrome?, #chromium_based?, #compatibility_view?, #core_media?, #duck_duck_go?, #edge?, #electron?, #facebook?, #firefox?, #google_search_app?, #huawei_browser?, #ie?, #initialize, #instagram?, #known?, #maxthon?, #meta, #micro_messenger?, #miui_browser?, #msie_full_version, #msie_version, #nokia?, #opera?, #opera_mini?, #otter?, #phantom_js?, #platform, #proxy?, #qq?, #quicktime?, #safari?, #safari_webapp_mode?, #samsung_browser?, #snapchat?, #sougou_browser?, #sputnik?, #to_s, #uc_browser?, #unknown?, #webkit?, #webkit_full_version, #weibo?, #yandex?
Constructor Details
This class inherits a constructor from Browser::Base
Instance Method Details
#device ⇒ Object
38
39
40
|
# File 'lib/browser/platform/ios.rb', line 38
def device
ua[MATCHER, 1]
end
|
#id ⇒ Object
30
31
32
|
# File 'lib/browser/platform/ios.rb', line 30
def id
:ios
end
|
#match? ⇒ Boolean
34
35
36
|
# File 'lib/browser/platform/ios.rb', line 34
def match?
ua.match?(MATCHER)
end
|
#name ⇒ Object
26
27
28
|
# File 'lib/browser/platform/ios.rb', line 26
def name
"iOS (#{device})"
end
|
#version ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/browser/platform/ios.rb', line 10
def version
matches = VERSION_MATCHER.match(ua)
return "0" unless matches
versions = [matches[:major]]
if matches[:patch]
versions.push(matches[:minor], matches[:patch])
else
versions.push(matches[:minor]) unless matches[:minor] == "0"
end
versions.join(".")
end
|