class Sys::Platform

The Platform class provides singleton methods to tell you what OS you’re on.

def self.bsd?

Returns whether or not you're on any BSD platform
def self.bsd?
  Uname.sysname =~ /bsd/i ? true : false
end

def self.linux?

Returns whether or not you're on Linux
def self.linux?
  Uname.sysname =~ /linux/i ? true : false
end

def self.mac?

Returns whether or not you're on a mac, i.e. OSX
def self.mac?
  Uname.sysname =~ /darwin|mac/i ? true : false
end

def self.unix?

Returns whether or not you're on a Unixy (non-Windows) OS
def self.unix?
  Uname.sysname =~ /microsoft/i ? false : true
end

def self.windows?

Returns whether or not you're on a Windows OS
def self.windows?
  Uname.sysname =~ /microsoft/i ? true : false
end