Class: Browser::InternetExplorer

Inherits:
Base
  • Object
show all
Defined in:
lib/browser/internet_explorer.rb

Direct Known Subclasses

Edge

Constant Summary collapse

TRIDENT_MAPPING =
{
  "4.0" => "8",
  "5.0" => "9",
  "6.0" => "10",
  "7.0" => "11",
  "8.0" => "12"
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#accept_language, #ua

Instance Method Summary collapse

Methods inherited from Base

#alipay?, #bot, #bot?, #chrome?, #core_media?, #device, #edge?, #firefox?, #ie?, #initialize, #known?, #meta, #micro_messenger?, #modern?, #nokia?, #opera?, #opera_mini?, #phantom_js?, #platform, #proxy?, #quicktime?, #safari?, #safari_webapp_mode?, #to_s, #uc_browser?, #version, #webkit?, #webkit_full_version, #weibo?, #yandex?

Constructor Details

This class inherits a constructor from Browser::Base

Instance Method Details

#compatibility_view?Boolean

Detect if IE is running in compatibility mode.

Returns:

  • (Boolean)


39
40
41
# File 'lib/browser/internet_explorer.rb', line 39

def compatibility_view?
  trident_version && msie_version.to_i < (trident_version.to_i + 4)
end

#full_versionObject



21
22
23
# File 'lib/browser/internet_explorer.rb', line 21

def full_version
  "#{ie_version}.0"
end

#idObject



13
14
15
# File 'lib/browser/internet_explorer.rb', line 13

def id
  :ie
end

#match?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/browser/internet_explorer.rb', line 34

def match?
  msie? || modern_ie?
end

#msie_full_versionObject



25
26
27
28
# File 'lib/browser/internet_explorer.rb', line 25

def msie_full_version
  (ua.match(%r{MSIE ([\d.]+)|Trident/.*?; rv:([\d.]+)}) && ($1 || $2)) ||
    "0.0"
end

#msie_versionObject



30
31
32
# File 'lib/browser/internet_explorer.rb', line 30

def msie_version
  msie_full_version.split(".").first
end

#nameObject



17
18
19
# File 'lib/browser/internet_explorer.rb', line 17

def name
  "Internet Explorer"
end