useragent 0.3.1 → 0.3.2
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.
@@ -25,10 +25,14 @@ class UserAgent
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# Before version 4.0, Chrome Frame declared itself (unversioned) in a comment;
|
28
|
-
# as of 4.0 it
|
28
|
+
# as of 4.0 it can declare itself versioned in a comment
|
29
|
+
# or as a separate product with a version
|
29
30
|
|
30
31
|
def chromeframe
|
31
|
-
application.comment.include?("chromeframe") || detect_product("chromeframe")
|
32
|
+
cf = application.comment.include?("chromeframe") || detect_product("chromeframe")
|
33
|
+
return cf if cf
|
34
|
+
cf_comment = application.comment.detect{|c| c['chromeframe/']}
|
35
|
+
cf_comment ? UserAgent.new(*cf_comment.split('/', 2)) : nil
|
32
36
|
end
|
33
37
|
|
34
38
|
def platform
|
@@ -14,8 +14,8 @@ class UserAgent
|
|
14
14
|
'Android'
|
15
15
|
elsif detect_product('Chrome')
|
16
16
|
'Chrome'
|
17
|
-
elsif platform == 'webOS' || platform == 'BlackBerry'
|
18
|
-
platform
|
17
|
+
elsif platform == 'webOS' || platform == 'BlackBerry' || platform == 'Symbian'
|
18
|
+
platform
|
19
19
|
else
|
20
20
|
'Safari'
|
21
21
|
end
|
@@ -71,9 +71,16 @@ class UserAgent
|
|
71
71
|
|
72
72
|
Version.new(str) if str
|
73
73
|
end
|
74
|
+
|
75
|
+
def application
|
76
|
+
apps = self.reject{|agent| agent.comment.nil? || agent.comment.empty?}
|
77
|
+
apps.first
|
78
|
+
end
|
74
79
|
|
75
|
-
def platform
|
76
|
-
if application.comment[0] =~ /
|
80
|
+
def platform
|
81
|
+
if application.comment[0] =~ /Symbian/
|
82
|
+
'Symbian'
|
83
|
+
elsif application.comment[0] =~ /webOS/
|
77
84
|
'webOS'
|
78
85
|
else
|
79
86
|
application.comment[0]
|
@@ -91,6 +98,8 @@ class UserAgent
|
|
91
98
|
def os
|
92
99
|
if platform == 'webOS'
|
93
100
|
"Palm #{last.product} #{last.version}"
|
101
|
+
elsif platform == 'Symbian'
|
102
|
+
application.comment[0]
|
94
103
|
else
|
95
104
|
OperatingSystems.normalize_os(application.comment[2])
|
96
105
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useragent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Peek
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-29 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements: []
|
72
72
|
|
73
73
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.5.2
|
75
75
|
signing_key:
|
76
76
|
specification_version: 3
|
77
77
|
summary: HTTP User Agent parser
|