Module: OS

Included in:
DailyProgress
Defined in:
lib/os.rb

Class Method Summary collapse

Class Method Details

.jruby?Boolean

Returns:

  • (Boolean)


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

def OS.jruby?
  RUBY_ENGINE == 'jruby'
end

.linux?Boolean

Returns:

  • (Boolean)


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

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

.mac?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/os.rb', line 6

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

.unix?Boolean

Returns:

  • (Boolean)


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

def OS.unix?
  !OS.windows?
end

.windows?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/os.rb', line 2

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

.wsl?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/os.rb', line 22

def OS.wsl?
  version = File.read(WSL_VERSION_PATH)
  OS.linux? and (/microsoft|wsl/ =~ version.downcase) != nil
end