Class: LLM::Repl::Input::Char Private

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

A single editable character of the input.

Instance Method Summary collapse

Constructor Details

#initialize(char) ⇒ LLM::Repl::Input::Char

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:

  • char (String)


10
11
12
# File 'lib/llm/repl/input/char.rb', line 10

def initialize(char)
  @char = char
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

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 true when both strings returned by the ##to_s method are considered equal by String#==.

Parameters:

Returns:

  • (Boolean)


20
21
22
# File 'lib/llm/repl/input/char.rb', line 20

def ==(other)
  to_s == other.to_s
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)


36
37
38
# File 'lib/llm/repl/input/char.rb', line 36

def empty?
  @char == ""
end

#hashInteger

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 hash consistent with #eql?, so equal chars behave as the same key in a Hash or Set.

Returns:

  • (Integer)


30
31
32
# File 'lib/llm/repl/input/char.rb', line 30

def hash
  to_s.hash
end

#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)


42
43
44
# File 'lib/llm/repl/input/char.rb', line 42

def to_s
  @char.dup
end