Module: CLI::UI::OS

Defined in:
lib/cli/ui/os.rb

Defined Under Namespace

Classes: Linux, Mac, Windows

Class Method Summary collapse

Class Method Details

.currentObject

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


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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