Module: CommandKit::OS::ClassMethods

Defined in:
lib/command_kit/os.rb

Instance Method Summary collapse

Instance Method Details

#os:linux, ...

Determines the current OS.

Returns:

  • (:linux, :macos, :freebsd, :openbsd, :netbsd, :windows, nil)

    The OS type or nil if the OS could not be determined.

Since:

  • 0.2.0



66
67
68
69
70
71
72
73
74
# File 'lib/command_kit/os.rb', line 66

def os
  if    RUBY_PLATFORM.include?('linux')   then :linux
  elsif RUBY_PLATFORM.include?('darwin')  then :macos
  elsif RUBY_PLATFORM.include?('freebsd') then :freebsd
  elsif RUBY_PLATFORM.include?('openbsd') then :openbsd
  elsif RUBY_PLATFORM.include?('netbsd')  then :netbsd
  elsif Gem.win_platform?                 then :windows
  end
end