Class: LLM::Repl::Input::Cache Private
- Inherits:
-
Object
- Object
- LLM::Repl::Input::Cache
- Defined in:
- lib/llm/repl/input/cache.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.
Tracks the state of the active completion so that repeated TAB presses can cycle through the candidate list.
Instance Attribute Summary collapse
- #candidates ⇒ Array<String> readonly private
- #index ⇒ Integer readonly private
Instance Method Summary collapse
- #include?(str) ⇒ Boolean private
- #initialize(candidates, index) ⇒ LLM::Repl::Input::Cache constructor private
-
#next_index ⇒ Integer
private
Returns the next index, wrapping around the list.
- #value ⇒ String private
Constructor Details
#initialize(candidates, index) ⇒ LLM::Repl::Input::Cache
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.
13 14 15 16 |
# File 'lib/llm/repl/input/cache.rb', line 13 def initialize(candidates, index) @candidates = candidates @index = index end |
Instance Attribute Details
#candidates ⇒ Array<String> (readonly)
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.
20 21 22 |
# File 'lib/llm/repl/input/cache.rb', line 20 def candidates @candidates end |
#index ⇒ Integer (readonly)
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.
24 25 26 |
# File 'lib/llm/repl/input/cache.rb', line 24 def index @index end |
Instance Method Details
#include?(str) ⇒ Boolean
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.
41 42 43 |
# File 'lib/llm/repl/input/cache.rb', line 41 def include?(str) @candidates.include?(str) end |
#next_index ⇒ Integer
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.
Returns the next index, wrapping around the list.
29 30 31 |
# File 'lib/llm/repl/input/cache.rb', line 29 def next_index (@index + 1) % @candidates.size end |
#value ⇒ 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.
35 36 37 |
# File 'lib/llm/repl/input/cache.rb', line 35 def value @candidates[@index] end |