Class: CLI::UI::OS
- Inherits:
-
Object
- Object
- CLI::UI::OS
- Defined in:
- lib/cli/ui/os.rb
Constant Summary collapse
- MAC =
OS.new
- LINUX =
OS.new
- FREEBSD =
OS.new
- WINDOWS =
OS.new(emoji: false, color_prompt: false, arrow_keys: false, shift_cursor: true)
Class Method Summary collapse
-
.current ⇒ Object
: -> OS.
Instance Method Summary collapse
-
#initialize(emoji: true, color_prompt: true, arrow_keys: true, shift_cursor: false) ⇒ OS
constructor
: (?emoji: bool, ?color_prompt: bool, ?arrow_keys: bool, ?shift_cursor: bool) -> void.
-
#shift_cursor_back_on_horizontal_absolute? ⇒ Boolean
: -> bool.
-
#suggest_arrow_keys? ⇒ Boolean
: -> bool.
-
#use_color_prompt? ⇒ Boolean
: -> bool.
-
#use_emoji? ⇒ Boolean
: -> bool.
Constructor Details
#initialize(emoji: true, color_prompt: true, arrow_keys: true, shift_cursor: false) ⇒ OS
: (?emoji: bool, ?color_prompt: bool, ?arrow_keys: bool, ?shift_cursor: bool) -> void
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
: -> OS
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cli/ui/os.rb', line 39 def current @current_os ||= case RbConfig::CONFIG['host_os'] when /darwin/ MAC when /linux/ LINUX when /freebsd/ FREEBSD 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
: -> bool
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
: -> bool
28 29 30 |
# File 'lib/cli/ui/os.rb', line 28 def suggest_arrow_keys? @arrow_keys end |
#use_color_prompt? ⇒ Boolean
: -> bool
23 24 25 |
# File 'lib/cli/ui/os.rb', line 23 def use_color_prompt? @color_prompt end |
#use_emoji? ⇒ Boolean
: -> bool
18 19 20 |
# File 'lib/cli/ui/os.rb', line 18 def use_emoji? @emoji end |