useragent 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bd2fddf09bf699480234fa4a5dd23ac9483fbb3
4
- data.tar.gz: 96c418dd604d71880768970b1d4daac20f4bcc59
3
+ metadata.gz: c0120f69b4e121786db5270652b47b8533658243
4
+ data.tar.gz: e2cff433dd5079b86067608f059db2a044ff1e48
5
5
  SHA512:
6
- metadata.gz: 06ecace6200dc406daf59dcd4caf10027df2dc1f09f45102573e6832c89fe1c48f70207dffb774463f1ced31f34d15fd4ef109d879169f7bdfb05cc2ada7303f
7
- data.tar.gz: 6ae18611dd35bf799b55fba0a7ea226f33aeda55d488ed4766e5d22b5ac4cd9ea4d7afdf1de0257a175e204c1824c0258ce3189d6c260f11ac90837a83e5e1ae
6
+ metadata.gz: 11de96864692a2eac9e6df71bf87d61ddba15875bc6673513c8f901447bb3e96bd1e5837f3fce4fd5c3264c02c40d0ee010ee3af6d113cf09d276057e94bda5f
7
+ data.tar.gz: 1146610d2c06d901ddd4bb51728253e2d18e6c4fe75cf26be0ebebd707c08cf4e161fa56ae436867f8f82f333a359eb3ea06b9d4e92e1ce389cbd1458fb79ef4
@@ -28,11 +28,21 @@ class UserAgent
28
28
  :strong
29
29
  elsif platform == "Macintosh"
30
30
  Security[application.comment[2]]
31
+ elsif mini?
32
+ Security[application.comment[-2]]
31
33
  else
32
34
  Security[application.comment[1]]
33
35
  end
34
36
  end
35
37
 
38
+ def mini?
39
+ /Opera Mini/ === application
40
+ end
41
+
42
+ def mobile?
43
+ mini?
44
+ end
45
+
36
46
  def os
37
47
  if application.comment.nil?
38
48
  nil
@@ -10,7 +10,7 @@ class UserAgent
10
10
  end
11
11
 
12
12
  def browser
13
- if detect_product('Chrome')
13
+ if detect_product('Chrome') || detect_product("CriOS")
14
14
  'Chrome'
15
15
  elsif os =~ /Android/
16
16
  'Android'
@@ -60,12 +60,16 @@ class UserAgent
60
60
 
61
61
  # Prior to Safari 3, the user agent did not include a version number
62
62
  def version
63
- str = if os =~ /CPU (?:iPhone |iPod )?OS ([\d_]+) like Mac OS X/
63
+ str = if os =~ /CPU (?:iPhone |iPod )?OS ([\d_]+) like Mac OS X/ && browser == "Safari"
64
64
  $1.gsub(/_/, '.')
65
65
  elsif product = detect_product('Version')
66
66
  product.version
67
67
  elsif browser == 'Chrome'
68
- chrome.version
68
+ if detect_product("chrome")
69
+ chrome.version
70
+ elsif detect_product("crios")
71
+ crios.version
72
+ end
69
73
  else
70
74
  BuildVersions[build.to_s]
71
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useragent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2013-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.0.0
80
+ rubygems_version: 2.0.3
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: HTTP User Agent parser