Class: LLM::Repl::Node Private

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/repl/node.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::Node class wraps a piece of text and optional curses attributes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, attrs = nil) ⇒ LLM::Repl::Node

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:

  • text (String)
  • attrs (Integer, nil) (defaults to: nil)


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

def initialize(text, attrs = nil)
  @text = text.to_s
  @attrs = attrs
end

Instance Attribute Details

#attrsInteger? (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:

  • (Integer, nil)


15
16
17
# File 'lib/llm/repl/node.rb', line 15

def attrs
  @attrs
end

#textString (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:

  • (String)


11
12
13
# File 'lib/llm/repl/node.rb', line 11

def text
  @text
end

Instance Method Details

#[](key) ⇒ 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.

Hash-like lookup.

Parameters:

  • key (Symbol)

Returns:

  • (String, Integer, nil)


30
31
32
33
34
35
# File 'lib/llm/repl/node.rb', line 30

def [](key)
  case key
  when :text then @text
  when :attrs then @attrs
  end
end