jrgifford
8/2/2011 - 5:26 PM

os-detection.rb

if RUBY_PLATFORM =~ /win32/
  puts "We're in Windows!"
elsif RUBY_PLATFORM =~ /linux/
  puts "We're in Linux!"
elsif RUBY_PLATFORM =~ /darwin/
  puts "We're in Mac OS X!"
elsif RUBY_PLATFORM =~ /freebsd/
  puts "We're in FreeBSD!"
elsif RUBY_PLATFORM =~ /java/
     puts "WHOOT JRUBY!!"
else
  puts "We're running under some secret government OS. :O"
end