Skip to content

Instantly share code, notes, and snippets.

@edymerchk
Created June 18, 2014 15:55
Show Gist options
  • Save edymerchk/8d88382a421377932e6f to your computer and use it in GitHub Desktop.
Save edymerchk/8d88382a421377932e6f to your computer and use it in GitHub Desktop.
require 'rbconfig'
def 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 "unknown os: #{host_os.inspect}"
end
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment