useragent 0.16.2 → 0.16.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9353f8e50827a2223a18102becd7c6c95dfba8d4
4
- data.tar.gz: bce76cb0bb897d6bdbb5bbf5ff34ed4790ac9310
3
+ metadata.gz: c20bcc2861b91b9daa438d2a1c436dc5b8904623
4
+ data.tar.gz: 05f1418f81ef79ea1388800f2f2b10d6e365035b
5
5
  SHA512:
6
- metadata.gz: ba2dd7b05214fa0bfc94fd6ef8ba49d4db87fc72e3ef49bff404a43e41e020d8a13c2353e1c633601f9e628428858467d548bba5c7cd49fe795c78ba4eeb2b06
7
- data.tar.gz: 8700e286bf4751301037ad50910d6c280a7bff809af3c4900df0c4efdae96b60bdcc25679f6c6c450ddef8256d9af237ffc00d78af796e0c129c2fd88db705c4
6
+ metadata.gz: 1b57837939d11ece3dc65209dca3d667390737a44f700af5d2533c2127731a5ed4a18dd7243a491a67a95bf38ddbf2a38cb98dad62e508a17d2bd4c0bc625298
7
+ data.tar.gz: 0ea1c78533a067e7833bdd57d3e652b12a634b61aea529d1ab3cec8a1c0c5c08d69d82a76cd1c22f5830613e61cc1e02e16f74f1ee8a5090396caff6cde5fbee
@@ -1,6 +1,13 @@
1
1
  class UserAgent
2
2
  module Browsers
3
3
  class InternetExplorer < Base
4
+ TRIDENT_ENGINES = {
5
+ "Trident/7.0" => "11.0",
6
+ "Trident/6.0" => "10.0",
7
+ "Trident/5.0" => "9.0",
8
+ "Trident/4.0" => "8.0",
9
+ }.freeze
10
+
4
11
  def self.extend?(agent)
5
12
  agent.application &&
6
13
  agent.application.comment &&
@@ -17,8 +24,19 @@ class UserAgent
17
24
  Version.new(str)
18
25
  end
19
26
 
27
+ def trident_version
28
+ if trident = application.comment.detect { |c| c['Trident/'] }
29
+ trident_version = TRIDENT_ENGINES.fetch(trident, trident)
30
+ Version.new(trident_version)
31
+ end
32
+ end
33
+
34
+ def real_version
35
+ [trident_version, version].sort.last
36
+ end
37
+
20
38
  def compatibility_view?
21
- version == "7.0" && application.comment.detect { |c| c['Trident/'] }
39
+ version < real_version
22
40
  end
23
41
 
24
42
  # Before version 4.0, Chrome Frame declared itself (unversioned) in a comment;
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.16.2
4
+ version: 0.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-16 00:00:00.000000000 Z
12
+ date: 2015-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake