class Sys::Platform

Constants

ARCH

The CPU architecture

IMPL

Returns the OS type, :macosx, :linux, :mingw32, etc

OS

Returns a basic OS family, either :windows or :unix

VERSION

The version of the sys-uname gem.

Public Class Methods

bsd?() click to toggle source

Returns whether or not you’re on any BSD platform

# File lib/sys/platform.rb, line 50
def self.bsd?
  Uname.sysname =~ /bsd/i ? true : false
end
linux?() click to toggle source

Returns whether or not you’re on Linux

# File lib/sys/platform.rb, line 40
def self.linux?
  Uname.sysname =~ /linux/i ? true : false
end
mac?() click to toggle source

Returns whether or not you’re on a mac, i.e. OSX

# File lib/sys/platform.rb, line 35
def self.mac?
  Uname.sysname =~ /darwin|mac/i ? true : false
end
solaris?() click to toggle source

Returns whether or not you’re on Solaris

# File lib/sys/platform.rb, line 45
def self.solaris?
  Uname.sysname =~ /sunos|solaris/i ? true : false
end
unix?() click to toggle source

Returns whether or not you’re on a Unixy (non-Windows) OS

# File lib/sys/platform.rb, line 30
def self.unix?
  Uname.sysname !~ /microsoft/i ? true : false
end
windows?() click to toggle source

Returns whether or not you’re on a Windows OS

# File lib/sys/platform.rb, line 25
def self.windows?
  Uname.sysname =~ /microsoft/i ? true : false
end