Class: Sys::Platform
- Inherits:
-
Object
- Object
- Sys::Platform
- Defined in:
- lib/sys/uname.rb,
lib/sys/platform.rb
Constant Summary collapse
- VERSION =
The version of the sys-uname gem.
Uname::VERSION
- ARCH =
The CPU architecture
File::ALT_SEPARATOR ? Uname.architecture.to_sym : Uname.machine.to_sym
- OS =
Returns a basic OS family, either :windows or :unix
File::ALT_SEPARATOR ? :windows : :unix
- IMPL =
Returns the OS type, :macosx, :linux, :mingw32, etc
case Uname.sysname when /darwin|mac/i :macosx when /mingw|windows/i require 'rbconfig' RbConfig::CONFIG['host_os'].split('_').first[/[a-z]+/i].downcase.to_sym when /linux/i :linux when /sunos|solaris/i :solaris when /bsd/i :bsd end
Class Method Summary collapse
-
.bsd? ⇒ Boolean
Returns whether or not you’re on any BSD platform.
-
.linux? ⇒ Boolean
Returns whether or not you’re on Linux.
-
.mac? ⇒ Boolean
Returns whether or not you’re on a mac, i.e.
-
.solaris? ⇒ Boolean
Returns whether or not you’re on Solaris.
-
.unix? ⇒ Boolean
Returns whether or not you’re on a Unixy (non-Windows) OS.
-
.windows? ⇒ Boolean
Returns whether or not you’re on a Windows OS.
Class Method Details
.bsd? ⇒ Boolean
Returns whether or not you’re on any BSD platform
50 51 52 |
# File 'lib/sys/platform.rb', line 50 def self.bsd? Uname.sysname =~ /bsd/i ? true : false end |
.linux? ⇒ Boolean
Returns whether or not you’re on Linux
40 41 42 |
# File 'lib/sys/platform.rb', line 40 def self.linux? Uname.sysname =~ /linux/i ? true : false end |
.mac? ⇒ Boolean
Returns whether or not you’re on a mac, i.e. OSX
35 36 37 |
# File 'lib/sys/platform.rb', line 35 def self.mac? Uname.sysname =~ /darwin|mac/i ? true : false end |
.solaris? ⇒ Boolean
Returns whether or not you’re on Solaris
45 46 47 |
# File 'lib/sys/platform.rb', line 45 def self.solaris? Uname.sysname =~ /sunos|solaris/i ? true : false end |