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.
10 11 12 13 14 15 |
# File 'lib/cli/ui/os.rb', line 10 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
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cli/ui/os.rb', line 38 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 |
Instance Method Details
#shift_cursor_back_on_horizontal_absolute? ⇒ Boolean
33 34 35 |
# File 'lib/cli/ui/os.rb', line 33 def shift_cursor_back_on_horizontal_absolute? @shift_cursor end |
#suggest_arrow_keys? ⇒ Boolean
28 29 30 |
# File 'lib/cli/ui/os.rb', line 28 def suggest_arrow_keys? @arrow_keys end |
#use_color_prompt? ⇒ Boolean
23 24 25 |
# File 'lib/cli/ui/os.rb', line 23 def use_color_prompt? @color_prompt end |
#use_emoji? ⇒ Boolean
18 19 20 |
# File 'lib/cli/ui/os.rb', line 18 def use_emoji? @emoji end |