Class: LLM::Repl::Transcript Private

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/repl/transcript.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::Transcript class stores streamed output for the REPL.

Constant Summary collapse

WIDTH =

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.

80

Instance Method Summary collapse

Constructor Details

#initializeLLM::Repl::Transcript

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/transcript.rb', line 13

def initialize
  @lines = [+""]
  @offset = 0
end

Instance Method Details

#scroll_downvoid

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.

This method returns an undefined value.



34
35
36
# File 'lib/llm/repl/transcript.rb', line 34

def scroll_down
  @offset = [@offset - 1, 0].max
end

#scroll_up(height) ⇒ void

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.

This method returns an undefined value.



27
28
29
30
# File 'lib/llm/repl/transcript.rb', line 27

def scroll_up(height)
  max = [@lines.size - height, 0].max
  @offset = [@offset + 1, max].min
end

#visible(height) ⇒ Array<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.

Parameters:

  • height (Integer)

Returns:

  • (Array<String>)


41
42
43
44
45
# File 'lib/llm/repl/transcript.rb', line 41

def visible(height)
  last = @lines.size - 1 - @offset
  first = [last - height + 1, 0].max
  @lines[first..last] || []
end

#write(chars) ⇒ void

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.

This method returns an undefined value.

Parameters:

  • chars (String)


21
22
23
# File 'lib/llm/repl/transcript.rb', line 21

def write(chars)
  chars.each_char { write_char(_1) }
end