Class: DeviceDetector::OS

Inherits:
Parser
  • Object
show all
Defined in:
lib/device_detector/os.rb

Constant Summary

Constants inherited from Parser

Parser::ROOT

Instance Attribute Summary

Attributes inherited from Parser

#user_agent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Parser

#initialize

Constructor Details

This class inherits a constructor from DeviceDetector::Parser

Class Method Details

.mapped_os_version(version, mapping) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/device_detector/os.rb', line 8

def mapped_os_version(version, mapping)
  return if version.nil?

  major_version = version.split('.').first

  mapping[version] || mapping[major_version]
end

Instance Method Details

#desktop?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/device_detector/os.rb', line 29

def desktop?
  DESKTOP_OSS.include?(family)
end

#familyObject



25
26
27
# File 'lib/device_detector/os.rb', line 25

def family
  os_info[:family]
end

#full_versionObject



33
34
35
36
# File 'lib/device_detector/os.rb', line 33

def full_version
  raw_version = super.to_s.split('_').join('.')
  raw_version == '' ? nil : raw_version
end

#nameObject



17
18
19
# File 'lib/device_detector/os.rb', line 17

def name
  os_info[:name]
end

#short_nameObject



21
22
23
# File 'lib/device_detector/os.rb', line 21

def short_name
  os_info[:short]
end