Skip to content

Instantly share code, notes, and snippets.

@majioa
Created Mar 13, 2013
Embed
What would you like to do?
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