class DeviceDetector::OS
Constants
- APPLE_OS_NAMES
- DESKTOP_OSS
- DOWNCASED_OPERATING_SYSTEMS
- FAMILY_TO_OS
- FIRE_OS_VERSION_MAPPING
- LINEAGE_OS_VERSION_MAPPING
- OPERATING_SYSTEMS
OS
short codes mapped to long names github.com/matomo-org/device-detector/blob/75d88bbefb0182f9207c9f48dc39b1bc8c7cc43f/Parser/OperatingSystem.php#L42-L220- OS_FAMILIES
Public Class Methods
mapped_os_version(version, mapping)
click to toggle source
# 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
Public Instance Methods
desktop?()
click to toggle source
# File lib/device_detector/os.rb, line 29 def desktop? DESKTOP_OSS.include?(family) end
family()
click to toggle source
# File lib/device_detector/os.rb, line 25 def family os_info[:family] end
full_version()
click to toggle source
Calls superclass method
# File lib/device_detector/os.rb, line 33 def full_version raw_version = super.to_s.split('_').join('.') raw_version == '' ? nil : raw_version end
name()
click to toggle source
# File lib/device_detector/os.rb, line 17 def name os_info[:name] end
short_name()
click to toggle source
# File lib/device_detector/os.rb, line 21 def short_name os_info[:short] end
Private Instance Methods
filenames()
click to toggle source
# File lib/device_detector/os.rb, line 335 def filenames ['oss.yml'] end
os_info()
click to toggle source
# File lib/device_detector/os.rb, line 40 def os_info from_cache(['os_info', self.class.name, user_agent]) do os_name = NameExtractor.new(user_agent, regex_meta).call if os_name && (short = DOWNCASED_OPERATING_SYSTEMS[os_name.downcase]) os_name = OPERATING_SYSTEMS[short] else short = 'UNK' end { name: os_name, short: short, family: FAMILY_TO_OS[short] } end end