module CLI::UI::OS

Public Class Methods

current() click to toggle source

Determines which OS is currently running the UI, to make it easier to adapt its behaviour to the features of the OS.

# File lib/cli/ui/os.rb, line 8
def self.current
  @current_os ||= case RbConfig::CONFIG['host_os']
  when /darwin/
    Mac
  when /linux/
    Linux
  else
    if RUBY_PLATFORM !~ /cygwin/ && ENV['OS'] == 'Windows_NT'
      Windows
    else
      raise "Could not determine OS from host_os #{RbConfig::CONFIG["host_os"]}"
    end
  end
end