Class: Origen::OperatingSystems

Inherits:
Object
  • Object
show all
Defined in:
lib/origen/operating_systems.rb

Overview

Provides methods to detect the operating system used at runtime, an instance of this class is automatically instantiated as Origen.os.

Examples:

Origen.os.windows?   # => false
Origen.os.linux?     # => true

Instance Method Summary collapse

Instance Method Details

#linux?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/origen/operating_systems.rb', line 17

def linux?
  !windows? && !mac?
end

#mac?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/origen/operating_systems.rb', line 13

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

#unix?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/origen/operating_systems.rb', line 21

def unix?
  !windows?
end

#windows?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/origen/operating_systems.rb', line 9

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