Module: Cxxproject::Utils::OS

Defined in:
lib/cxxproject/utils/utils.rb

Overview

Simple helper query the operating system we are running in

Class Method Summary collapse

Class Method Details

.linux?Boolean

Is it linux

Returns:

  • (Boolean)


28
29
30
# File 'lib/cxxproject/utils/utils.rb', line 28

def self.linux?
  OS.unix? and not OS.mac?
end

.mac?Boolean

Is it osx

Returns:

  • (Boolean)


18
19
20
# File 'lib/cxxproject/utils/utils.rb', line 18

def self.mac?
  (RUBY_PLATFORM =~ /darwin/) != nil
end

.osObject



6
7
8
9
10
# File 'lib/cxxproject/utils/utils.rb', line 6

def self.os
  return :OSX if mac?
  return :WINDOWS if windows?
  return :UNIX
end

.unix?Boolean

Is it kind of unix

Returns:

  • (Boolean)


23
24
25
# File 'lib/cxxproject/utils/utils.rb', line 23

def self.unix?
  !OS.windows?
end

.windows?Boolean

Is it windows

Returns:

  • (Boolean)


13
14
15
# File 'lib/cxxproject/utils/utils.rb', line 13

def self.windows?
  (RUBY_PLATFORM =~ /cygwin|mswin|mingw|bccwin|wince|emx/) != nil
end