Created
March 13, 2013 07:33
-
-
Save majioa/5150006 to your computer and use it in GitHub Desktop.
System properties detection in ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# origin is here: http://stackoverflow.com/questions/11784109/detecting-operating-systems-in-ruby | |
require 'rbconfig' | |
module SpecModule | |
def self.os | |
@os ||= ( | |
host_os = RbConfig::CONFIG['host_os'] | |
case host_os | |
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ | |
:windows | |
when /darwin|mac os/ | |
:macosx | |
when /linux/ | |
:linux | |
when /solaris|bsd/ | |
:unix | |
else | |
raise Error::WebDriverError, "unknown os: #{host_os.inspect}" | |
end ) ; end ; end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment