lib/aua/operating_systems/mac.rb in aua-0.2.2 vs lib/aua/operating_systems/mac.rb in aua-0.2.3

- old
+ new

@@ -1,13 +1,13 @@ module Aua::OperatingSystems::Mac - + def self.extend?(agent) - agent.platform_string == "Macintosh" || - agent.os_string && agent.os_string =~ PATTERN_MACOS || + agent.platform_string == "Macintosh" || + agent.os_string && agent.os_string =~ PATTERN_MACOS || agent.products.include?("Darwin") end - + PATTERN_OSX = /Mac OS X\s?([\d\._]+)?/ PATTERN_MACOS = /Mac_PowerPC/ DAWRWIN_2_OSX = { '1.0.2' => 'DP2', '1.1' => 'DP4', @@ -35,42 +35,42 @@ '10.4.0' => '10.6.4', '10.4.1' => '10.6.4', '10.5.0' => '10.6.5', '10.6.0' => '10.6.6' } - + def platform darwin? && !DAWRWIN_2_OSX[version_of(:Darwin)] ? :Darwin : :Macintosh end - + def os_name @os_name ||= if osx? :MacOSX elsif darwin? DAWRWIN_2_OSX[version_of(:Darwin)] ? :MacOSX : :Darwin elsif macos? :MacOS end end - + def os_version @os_version ||= if m = osx? m[1] ? m[1].gsub(/_/, ".") : nil elsif darwin? DAWRWIN_2_OSX[version_of(:Darwin)] || version_of(:Darwin) end end - + private - + def osx? app_comments_string.match PATTERN_OSX end - + def macos? app_comments_string.match PATTERN_MACOS end - + def darwin? products.include?("Darwin") end end \ No newline at end of file