Module: OS

Defined in:
lib/croesus/platform.rb

Overview

Gets the current Operating System.

Class Method Summary collapse

Class Method Details

.linux?Boolean

Returns:



42
43
44
45
46
# File 'lib/croesus/platform.rb', line 42

def self.linux?
  linux = /linux/i

  (RbConfig::CONFIG['host_os'] =~ linux) != nil
end

.mac?Boolean

Returns:



30
31
32
33
34
# File 'lib/croesus/platform.rb', line 30

def self.mac?
  mac = /darwin|mac os/i

  (RbConfig::CONFIG['host_os'] =~ mac) != nil
end

.unix?Boolean

Returns:



36
37
38
39
40
# File 'lib/croesus/platform.rb', line 36

def self.unix?
  unix = /solaris|bsd/i

  (RbConfig::CONFIG['host_os'] =~ unix) != nil
end

.windows?Boolean

Returns:



24
25
26
27
28
# File 'lib/croesus/platform.rb', line 24

def self.windows?
  windows = /cygwin|mswin|mingw|bccwin|wince|emx/i

  (RbConfig::CONFIG['host_os'] =~ windows) != nil
end