Class: CLI::UI::OS
Constant Summary collapse
- MAC =
OS.new
- LINUX =
OS.new
- WINDOWS =
OS.new(emoji: false, color_prompt: false, arrow_keys: false, shift_cursor: true)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(emoji: true, color_prompt: true, arrow_keys: true, shift_cursor: false) ⇒ OS
constructor
A new instance of OS.
- #shift_cursor_back_on_horizontal_absolute? ⇒ Boolean
- #suggest_arrow_keys? ⇒ Boolean
- #use_color_prompt? ⇒ Boolean
- #use_emoji? ⇒ Boolean
Methods included from T::Sig
Constructor Details
#initialize(emoji: true, color_prompt: true, arrow_keys: true, shift_cursor: false) ⇒ OS
Returns a new instance of OS.
12 13 14 15 16 17 |
# File 'lib/cli/ui/os.rb', line 12 def initialize(emoji: true, color_prompt: true, arrow_keys: true, shift_cursor: false) @emoji = emoji @color_prompt = color_prompt @arrow_keys = arrow_keys @shift_cursor = shift_cursor end |
Class Method Details
.current ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cli/ui/os.rb', line 43 def 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 |
Instance Method Details
#shift_cursor_back_on_horizontal_absolute? ⇒ Boolean
35 36 37 |
# File 'lib/cli/ui/os.rb', line 35 def shift_cursor_back_on_horizontal_absolute? @shift_cursor end |
#suggest_arrow_keys? ⇒ Boolean
30 31 32 |
# File 'lib/cli/ui/os.rb', line 30 def suggest_arrow_keys? @arrow_keys end |
#use_color_prompt? ⇒ Boolean
25 26 27 |
# File 'lib/cli/ui/os.rb', line 25 def use_color_prompt? @color_prompt end |
#use_emoji? ⇒ Boolean
20 21 22 |
# File 'lib/cli/ui/os.rb', line 20 def use_emoji? @emoji end |