Class: LLM::Repl::Input Private
- Inherits:
-
Object
- Object
- LLM::Repl::Input
- Defined in:
- lib/llm/repl/input.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The LLM::Repl::Input class manages the editable input line shown at the bottom of the REPL.
Constant Summary collapse
- UP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Curses::Key::UP
- DOWN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Curses::Key::DOWN
- ENTER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[Curses::Key::ENTER, 10, 13]
- BACKSPACE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[Curses::Key::BACKSPACE, 127]
- EOF =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[nil, 4]
Instance Method Summary collapse
- #initialize(provider) ⇒ LLM::Repl::Input constructor private
- #readline(window) ⇒ String? private
- #to_s ⇒ String private
Constructor Details
#initialize(provider) ⇒ LLM::Repl::Input
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 |
# File 'lib/llm/repl/input.rb', line 18 def initialize(provider) @provider = provider @buffer = +"" end |
Instance Method Details
#readline(window) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 31 32 33 34 |
# File 'lib/llm/repl/input.rb', line 26 def readline(window) catch(:done) do @buffer.clear loop do on_char(window, window.getch) window.redraw end end end |
#to_s ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/llm/repl/input.rb', line 38 def to_s "> #{@buffer}" end |