Class: LLM::Repl::Input::Char Private
- Inherits:
-
Object
- Object
- LLM::Repl::Input::Char
- 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
-
#==(other) ⇒ Boolean
(also: #eql?)
private
Returns true when both strings returned by the ##to_s method are considered equal by String#==.
- #empty? ⇒ Boolean private
-
#hash ⇒ Integer
private
Returns a hash consistent with #eql?, so equal chars behave as the same key in a Hash or Set.
- #initialize(char) ⇒ LLM::Repl::Input::Char constructor private
- #to_s ⇒ String private
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.
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#==.
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.
36 37 38 |
# File 'lib/llm/repl/input/char.rb', line 36 def empty? @char == "" end |
#hash ⇒ 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 a hash consistent with #eql?, so equal chars behave as the same key in a Hash or Set.
30 31 32 |
# File 'lib/llm/repl/input/char.rb', line 30 def hash to_s.hash end |
#to_s ⇒ 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.
42 43 44 |
# File 'lib/llm/repl/input/char.rb', line 42 def to_s @char.dup end |