Sha256: 55dbce0438503dbf2ac5236e77cd2cfa63ecfa5fd0ed6f4fa30546c5a265df8d
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
require 'rbconfig' module CLI module UI module OS # Determines which OS is currently running the UI, to make it easier to # adapt its behaviour to the features of the OS. 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 class Mac class << self def supports_emoji? true end def supports_color_prompt? true end def supports_arrow_keys? true end def shift_cursor_on_line_reset? false end end end class Linux < Mac end class Windows class << self def supports_emoji? false end def supports_color_prompt? false end def supports_arrow_keys? false end def shift_cursor_on_line_reset? true end end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
rfix-3.0.1 | vendor/cli-ui/lib/cli/ui/os.rb |
rfix-3.0.0 | vendor/cli-ui/lib/cli/ui/os.rb |
cli-ui-1.5.1 | lib/cli/ui/os.rb |
cli-ui-1.5.0 | lib/cli/ui/os.rb |