useragent 0.16.6 → 0.16.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/user_agent.rb +4 -0
- data/lib/user_agent/browsers/base.rb +8 -3
- data/lib/user_agent/browsers/edge.rb +2 -6
- data/lib/user_agent/browsers/webkit.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29ec5687df8a0fadd9e1ddc9257131aa1193e7b6
|
4
|
+
data.tar.gz: a6431baf15ed2cf458c4b69d9b8ad946aaa155dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76df2579cec51deb068e072ed2333ff2a2646c9238a8f1d9104b18231d52f6b27151eab69dd45de5402b308d12b302e0c9909a9cbfe87beab6c886c222e5b8e9
|
7
|
+
data.tar.gz: ba7a59272edf01fa33acc3b8aff2fbb2f61b8b7a165e526216fe5eee39b2f79875e282f094928aec15931adba35a96b8b545ad0dcc242dc2c003bf88122b0293
|
data/lib/user_agent.rb
CHANGED
@@ -57,8 +57,7 @@ class UserAgent
|
|
57
57
|
true
|
58
58
|
elsif os =~ /Android/
|
59
59
|
true
|
60
|
-
elsif application && application.
|
61
|
-
application.comment.detect { |k, v| k =~ /^IEMobile/ }
|
60
|
+
elsif application && application.detect_comment { |c| c =~ /^IEMobile/ }
|
62
61
|
true
|
63
62
|
else
|
64
63
|
false
|
@@ -119,7 +118,13 @@ class UserAgent
|
|
119
118
|
end
|
120
119
|
|
121
120
|
def detect_comment(comment)
|
122
|
-
detect { |useragent| useragent.
|
121
|
+
detect { |useragent| useragent.detect_comment { |c| c == comment } }
|
122
|
+
end
|
123
|
+
|
124
|
+
def detect_comment_match(regexp)
|
125
|
+
comment_match = nil
|
126
|
+
detect { |useragent| useragent.detect_comment { |c| comment_match = c.match(regexp) } }
|
127
|
+
comment_match
|
123
128
|
end
|
124
129
|
end
|
125
130
|
end
|
@@ -26,14 +26,10 @@ class UserAgent
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def os_comment
|
29
|
-
if
|
30
|
-
|
29
|
+
if comment_match = detect_comment_match(OS_REGEXP)
|
30
|
+
comment_match.to_s
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
34
|
-
def comment_os_match(useragent)
|
35
|
-
useragent.comment && useragent.comment.join("; ").match(OS_REGEXP)
|
36
|
-
end
|
37
33
|
end
|
38
34
|
end
|
39
35
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
class UserAgent
|
2
2
|
module Browsers
|
3
3
|
class Webkit < Base
|
4
|
+
WEBKIT_PRODUCT_REGEXP = /\AAppleWebKit\z/i
|
5
|
+
WEBKIT_VERSION_REGEXP = /\A(?<webkit>AppleWebKit)\/(?<version>[\d\.]+)/i
|
6
|
+
|
4
7
|
def self.extend?(agent)
|
5
|
-
agent.detect { |useragent| useragent.product =~
|
8
|
+
agent.detect { |useragent| useragent.product =~ WEBKIT_PRODUCT_REGEXP || useragent.detect_comment { |c| c =~ WEBKIT_VERSION_REGEXP } }
|
6
9
|
end
|
7
10
|
|
8
11
|
def browser
|
@@ -84,7 +87,11 @@ class UserAgent
|
|
84
87
|
end
|
85
88
|
|
86
89
|
def webkit
|
87
|
-
detect { |useragent| useragent.product =~
|
90
|
+
if product_match = detect { |useragent| useragent.product =~ WEBKIT_PRODUCT_REGEXP }
|
91
|
+
product_match
|
92
|
+
elsif comment_match = detect_comment_match(WEBKIT_VERSION_REGEXP)
|
93
|
+
UserAgent.new(comment_match[:webkit], comment_match[:version])
|
94
|
+
end
|
88
95
|
end
|
89
96
|
|
90
97
|
def security
|