Module: Digiproc::OS

Included in:
Rbplot::LinePlot
Defined in:
lib/concerns/os.rb

Overview

Deternine the OS for classes which need to perform system commands

Instance Method Summary collapse

Instance Method Details

#linux?Boolean

return true if in a linux env

Returns:

  • (Boolean)


26
27
28
# File 'lib/concerns/os.rb', line 26

def linux?
    unix? and not mac?
end

#mac?Boolean

return true if in a mac env

Returns:

  • (Boolean)


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

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

#ruby?Boolean

return true if using jruby

Returns:

  • (Boolean)


32
33
34
# File 'lib/concerns/os.rb', line 32

def ruby?
    RUBY_ENGINE == 'jruby'
end

#unix?Boolean

return true if in a unix env

Returns:

  • (Boolean)


20
21
22
# File 'lib/concerns/os.rb', line 20

def unix?
    !windows?
end

#windows?Boolean

return true if in a windows env

Returns:

  • (Boolean)


8
9
10
# File 'lib/concerns/os.rb', line 8

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