forked from fnando/browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chrome.rb
44 lines (39 loc) · 864 Bytes
/
chrome.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
module Browser
class Chrome < Base
def id
:chrome
end
def name
"Chrome"
end
def full_version
# Each regex on its own line to enforce precedence.
ua[%r{Chrome/([\d.]+)}, 1] ||
ua[%r{CriOS/([\d.]+)}, 1] ||
ua[%r{Safari/([\d.]+)}, 1] ||
ua[%r{AppleWebKit/([\d.]+)}, 1] ||
"0.0"
end
def chromium_based?
true
end
def match?
ua.match?(/Chrome|CriOS/) &&
!ua.match?(/PhantomJS|FxiOS|ArchiveBot/) &&
!opera? &&
!edge? &&
!duck_duck_go? &&
!yandex? &&
!sputnik? &&
!samsung_browser? &&
!huawei_browser? &&
!miui_browser? &&
!maxthon? &&
!mail_master? &&
!qq? &&
!sougou_browser? &&
!google_search_app?
end
end
end