Class: LLM::Repl::Input::Row Private

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/repl/input/row.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.

One line of the input. chars holds the editable characters. break_type records how this line got started: an auto-wrap (:space) or a real newline (:newline). The first row has no break type. It decides how the input is flattened on #take.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(break_type = nil) ⇒ Row

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 a new instance of Row.

Parameters:

  • break_type (Symbol, nil) (defaults to: nil)

    How this line was started.



22
23
24
25
# File 'lib/llm/repl/input/row.rb', line 22

def initialize(break_type = nil)
  @chars = []
  @break_type = break_type
end

Instance Attribute Details

#charsArray<Input::Char> (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.

Returns:



12
13
14
# File 'lib/llm/repl/input/row.rb', line 12

def chars
  @chars
end

#break_typeSymbol?

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 :space or :newline, or nil for the first row.

Returns:

  • (Symbol, nil)

    :space or :newline, or nil for the first row.



17
18
19
# File 'lib/llm/repl/input/row.rb', line 17

def break_type
  @break_type
end

Instance Method Details

#to_sString

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:

  • (String)


29
30
31
# File 'lib/llm/repl/input/row.rb', line 29

def to_s
  chars.map(&:to_s).join
end

#empty?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.

Returns:

  • (Boolean)


35
36
37
# File 'lib/llm/repl/input/row.rb', line 35

def empty?
  chars.empty?
end