Skip to content

Instantly share code, notes, and snippets.

@majioa
Created March 13, 2013 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save majioa/5150006 to your computer and use it in GitHub Desktop.
Save majioa/5150006 to your computer and use it in GitHub Desktop.
System properties detection in ruby
# 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