Class: Sbire::OS

Inherits:
Object
  • Object
show all
Defined in:
lib/sbire/os.rb

Class Method Summary collapse

Class Method Details

.famillyObject



3
4
5
6
7
# File 'lib/sbire/os.rb', line 3

def self.familly
  return "win" if OS.windows?
  return "linux" if OS.unix? || OS.linux?
  return "mac" if OS.mac?
end

.linux?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/sbire/os.rb', line 21

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

.mac?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/sbire/os.rb', line 13

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

.unix?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/sbire/os.rb', line 17

def self.unix?
  !OS.windows?
end

.windows?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/sbire/os.rb', line 9

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