Class: UserAgent::Browsers::InternetExplorer
- Inherits:
-
Base
- Object
- Array
- Base
- UserAgent::Browsers::InternetExplorer
show all
- Defined in:
- lib/user_agent/browsers/internet_explorer.rb
Constant Summary
collapse
- TRIDENT_ENGINES =
{
"Trident/8.0" => "11.0",
"Trident/7.0" => "11.0",
"Trident/6.0" => "10.0",
"Trident/5.0" => "9.0",
"Trident/4.0" => "8.0",
}.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#<=>, #application, #bot?, #eql?, #method_missing, #mobile?, #respond_to?, #to_h, #to_s, #to_str
Methods included from Comparable
#<, #<=, #==, #>, #>=
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class UserAgent::Browsers::Base
Class Method Details
.extend?(agent) ⇒ Boolean
12
13
14
15
16
17
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 12
def self.extend?(agent)
agent.application &&
agent.application. &&
(agent.application.[1] =~ /MSIE/ ||
agent.application..join('; ') =~ /Trident.+rv:/)
end
|
Instance Method Details
#browser ⇒ Object
19
20
21
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 19
def browser
"Internet Explorer"
end
|
#chromeframe ⇒ Object
Before version 4.0, Chrome Frame declared itself (unversioned) in a comment; as of 4.0 it can declare itself versioned in a comment or as a separate product with a version
46
47
48
49
50
51
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 46
def chromeframe
cf = application..include?("chromeframe") || detect_product("chromeframe")
return cf if cf
= application..detect { |c| c['chromeframe/'] }
? UserAgent.new(*.split('/', 2)) : nil
end
|
#compatibility_view? ⇒ Boolean
39
40
41
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 39
def compatibility_view?
trident_version && version < real_version
end
|
#os ⇒ Object
57
58
59
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 57
def os
OperatingSystems.normalize_os(application..join('; ').match(/Windows NT [\d\.]+|Windows Phone (OS )?[\d\.]+/).to_s)
end
|
53
54
55
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 53
def platform
"Windows"
end
|
#real_version ⇒ Object
35
36
37
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 35
def real_version
[trident_version, version].sort.last
end
|
#trident_version ⇒ Object
28
29
30
31
32
33
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 28
def trident_version
if trident = application..detect { |c| c['Trident/'] }
trident_version = TRIDENT_ENGINES.fetch(trident, trident)
Version.new(trident_version)
end
end
|
#version ⇒ Object
23
24
25
26
|
# File 'lib/user_agent/browsers/internet_explorer.rb', line 23
def version
str = application..join('; ')[/(MSIE\s|rv:)([\d\.]+)/, 2]
Version.new(str)
end
|