Class: DuckTest::Platforms::OSHelper
- Inherits:
-
Object
- Object
- DuckTest::Platforms::OSHelper
- Defined in:
- lib/duck_test/platforms/os_helper.rb
Overview
Methods used to determine the current operating system platform.
Class Method Summary (collapse)
-
+ (Boolean) available?
Determines if a native listener is available for the current platform.
-
+ (Symbol) current_os
Returns a Symbol indicating the current operating system.
-
+ (Boolean) is_linux?
Determines if the current operating system is: Linux.
-
+ (Boolean) is_mac?
Determines if the current operating system is: Macintosh.
-
+ (Boolean) is_windows?
Determines if the current operating system is: Windoze.
Class Method Details
+ (Boolean) available?
Determines if a native listener is available for the current platform.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/duck_test/platforms/os_helper.rb', line 67 def self.available? if self.is_linux? return Platforms::Linux::Listener.available? elsif self.is_mac? return Platforms::Mac::Listener.available? elsif self.is_windows? return Platforms::Windows::Listener.available? end return false end |
+ (Symbol) current_os
Returns a Symbol indicating the current operating system.
Currently returns one of four possible values:
:linux
:mac
:windows
:unknown
92 93 94 95 96 97 |
# File 'lib/duck_test/platforms/os_helper.rb', line 92 def self.current_os return :linux if self.is_linux? return :mac if self.is_mac? return :windows if self.is_windows? return :unknown end |
+ (Boolean) is_linux?
Determines if the current operating system is: Linux
46 47 48 |
# File 'lib/duck_test/platforms/os_helper.rb', line 46 def self.is_linux? RUBY_PLATFORM =~ /linux/i end |
+ (Boolean) is_mac?
Determines if the current operating system is: Macintosh
53 54 55 |
# File 'lib/duck_test/platforms/os_helper.rb', line 53 def self.is_mac? RUBY_PLATFORM =~ /darwin/i end |
+ (Boolean) is_windows?
Determines if the current operating system is: Windoze
60 61 62 |
# File 'lib/duck_test/platforms/os_helper.rb', line 60 def self.is_windows? RUBY_PLATFORM =~ /mswin|mingw/i end |