Class: Legion::TTY::Components::InputBar
- Inherits:
-
Object
- Object
- Legion::TTY::Components::InputBar
- Defined in:
- lib/legion/tty/components/input_bar.rb
Instance Method Summary collapse
- #clear_thinking ⇒ Object
-
#initialize(name: 'User', reader: nil) ⇒ InputBar
constructor
A new instance of InputBar.
- #prompt_string ⇒ Object
- #read_line ⇒ Object
- #show_thinking ⇒ Object
- #thinking? ⇒ Boolean
Constructor Details
#initialize(name: 'User', reader: nil) ⇒ InputBar
Returns a new instance of InputBar.
9 10 11 12 13 |
# File 'lib/legion/tty/components/input_bar.rb', line 9 def initialize(name: 'User', reader: nil) @name = name @reader = reader || build_default_reader @thinking = false end |
Instance Method Details
#clear_thinking ⇒ Object
27 28 29 |
# File 'lib/legion/tty/components/input_bar.rb', line 27 def clear_thinking @thinking = false end |
#prompt_string ⇒ Object
15 16 17 |
# File 'lib/legion/tty/components/input_bar.rb', line 15 def prompt_string "#{Theme.c(:accent, @name)} #{Theme.c(:primary, '>')} " end |
#read_line ⇒ Object
19 20 21 |
# File 'lib/legion/tty/components/input_bar.rb', line 19 def read_line @reader.read_line(prompt_string) end |
#show_thinking ⇒ Object
23 24 25 |
# File 'lib/legion/tty/components/input_bar.rb', line 23 def show_thinking @thinking = true end |
#thinking? ⇒ Boolean
31 32 33 |
# File 'lib/legion/tty/components/input_bar.rb', line 31 def thinking? @thinking end |