lib/aua/operating_systems/windows.rb in aua-0.2.3 vs lib/aua/operating_systems/windows.rb in aua-0.2.4
- old
+ new
@@ -5,10 +5,12 @@
(agent.app_comments.include?("Windows") ||
agent.comments_string =~ PATTERN)
end
VERSIONS = {
+ "10.0" => "10",
+ "NT 10.0" => "10",
"NT 6.3" => "8.1",
"NT 6.2" => "8",
"NT 6.1" => "7",
"NT 6.0" => "Vista",
"NT 5.2" => "XP",
@@ -20,19 +22,26 @@
"95" => "95",
"CE" => "CE",
"9x 4.90" => "ME"
}
- PATTERN = /Win(dows)?\s?([\d\sA-Zx\.]+)/
+ PATTERN = /Win(dows)?(\sPhone)?\s?([\d\sA-Zx\.]+)/
+ PHONE_PATTERN = /Windows Phone/
def platform
:Windows
end
def os_name
- :Windows
+ @os_name ||= windows_phone? ? :WindowsPhone : :Windows
end
def os_version
- @os_version ||= comments_string =~ PATTERN && VERSIONS[$2] || $2
+ @os_version ||= comments_string =~ PATTERN && VERSIONS[$3] || $3
+ end
+
+ private
+
+ def windows_phone?
+ !!(comments_string =~ PHONE_PATTERN)
end
end
\ No newline at end of file