useragent 0.8.0 → 0.8.1

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: 2658435598c1604bdebca0e0d989073e2e01a788
4
- data.tar.gz: 7a8ecbe3137b1c26dff955a319955e5ef47e2007
3
+ metadata.gz: 578e455222323d0c5fcc463b1b0cb2c349ad2df9
4
+ data.tar.gz: 50f22bcd7469ba90f4ef42cd098d36e19c937c1c
5
5
  SHA512:
6
- metadata.gz: 191b834bc118d29098f5b22b5c980d74fb8d5b63f41092804a16fe0c987d0bf00981a5db18153e3bc3b4afd220d8524097be4c8bed15206db511838c98df7546
7
- data.tar.gz: 153c59ccf82db939f2215dd1df088fedf9d557767d2d3085504f3421ae2c1a94b651afa1a468cc9d7e346ed307d45bfd561198b860b0eb285fcaaeda46c78ac6
6
+ metadata.gz: e82e4a08f86def642e8d41ae7f938ff11393c3e3047c7045c8033df301d61c9281801afbb906809a19418425de8c60058965f7fc5c795ffc854e6142c0013753
7
+ data.tar.gz: 45840759712d99fe573834bf988ea278e2a4af448c09c60c6c44b71ca070b13a5c747cf9ece81e54758e3572339d312d65f38e62e2b7a280f949a5058e441629
@@ -0,0 +1,73 @@
1
+ class UserAgent
2
+ module Browsers
3
+ module Chrome
4
+ def self.extend?(agent)
5
+ agent.detect { |useragent|
6
+ useragent.product == 'Chrome' ||
7
+ useragent.product == 'CriOS'
8
+ }
9
+ end
10
+
11
+ def browser
12
+ 'Chrome'
13
+ end
14
+
15
+ def build
16
+ webkit.version
17
+ end
18
+
19
+ # Prior to Safari 3, the user agent did not include a version number
20
+ def version
21
+ str = if detect_product("CriOs")
22
+ crios.version
23
+ else
24
+ chrome.version
25
+ end
26
+
27
+ Version.new(str) if str
28
+ end
29
+
30
+ def application
31
+ self.reject { |agent| agent.comment.nil? || agent.comment.empty? }.first
32
+ end
33
+
34
+ def platform
35
+ if application.nil?
36
+ nil
37
+ elsif application.comment[0] =~ /Windows/
38
+ 'Windows'
39
+ else
40
+ application.comment[0]
41
+ end
42
+ end
43
+
44
+ def webkit
45
+ detect { |useragent| useragent.product == "AppleWebKit" }
46
+ end
47
+
48
+ def os
49
+ if application
50
+ if application.comment[0] =~ /Windows NT/
51
+ OperatingSystems.normalize_os(application.comment[0])
52
+ elsif application.comment[2].nil?
53
+ OperatingSystems.normalize_os(application.comment[1])
54
+ elsif application.comment[1] =~ /Android/
55
+ OperatingSystems.normalize_os(application.comment[1])
56
+ else
57
+ OperatingSystems.normalize_os(application.comment[2])
58
+ end
59
+ else
60
+ nil
61
+ end
62
+ end
63
+
64
+ def localization
65
+ if application.nil?
66
+ nil
67
+ else
68
+ application.comment[3]
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useragent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
@@ -48,6 +48,7 @@ files:
48
48
  - lib/user_agent.rb
49
49
  - lib/user_agent/browsers.rb
50
50
  - lib/user_agent/browsers/all.rb
51
+ - lib/user_agent/browsers/chrome.rb
51
52
  - lib/user_agent/browsers/gecko.rb
52
53
  - lib/user_agent/browsers/internet_explorer.rb
53
54
  - lib/user_agent/browsers/opera.rb