module CommandKit::OS::ClassMethods

Public Instance Methods

os() click to toggle source

Determines the current OS.

@return [:linux, :macos, :freebsd, :openbsd, :netbsd, :windows, nil]

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

@api semipublic

@since 0.2.0

# File lib/command_kit/os.rb, line 64
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