lib/user_agent/operating_systems.rb in useragent-0.12.0 vs lib/user_agent/operating_systems.rb in useragent-0.13.0
- old
+ new
@@ -14,13 +14,24 @@
"Windows 95" => "Windows 95",
"Windows CE" => "Windows CE"
}.freeze
def self.normalize_os(os)
- Windows[os] || normalize_mac_os_x(os) || os
+ Windows[os] || normalize_mac_os_x(os) || normalize_ios(os) || os
end
private
+ def self.normalize_ios(os)
+ if os =~ /CPU OS\s*([0-9_\.]+)?\slike Mac OS X/
+ if $1.nil?
+ "iOS"
+ else
+ version = $1.gsub('_', '.')
+ "iOS #{version}"
+ end
+ end
+ end
+
def self.normalize_mac_os_x(os)
if os =~ /(?:Intel|PPC) Mac OS X\s*([0-9_\.]+)?/
if $1.nil?
"OS X"
else