class DeviceDetector::OS
Constants
- DESKTOP_OSS
- DOWNCASED_OPERATING_SYSTEMS
- FAMILY_TO_OS
- OPERATING_SYSTEMS
OS short codes mapped to long names
- OS_FAMILIES
Public Instance Methods
desktop?()
click to toggle source
# File lib/device_detector/os.rb, line 18 def desktop? DESKTOP_OSS.include?(family) end
family()
click to toggle source
# File lib/device_detector/os.rb, line 14 def family os_info[:family] end
full_version()
click to toggle source
Calls superclass method
# File lib/device_detector/os.rb, line 22 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 6 def name os_info[:name] end
short_name()
click to toggle source
# File lib/device_detector/os.rb, line 10 def short_name os_info[:short] end
Private Instance Methods
filenames()
click to toggle source
# File lib/device_detector/os.rb, line 156 def filenames ['oss.yml'] end
os_info()
click to toggle source
# File lib/device_detector/os.rb, line 29 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