Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/utils/string.rb
Overview
This class provides additional methods to the standard Ruby String class, allowing for the removal of ANSI codes, and conversion to Key, Question, and Message objects.
Instance Method Summary collapse
-
#remove_ansi ⇒ String
Removes ANSI escape codes from the string.
-
#to_key ⇒ Key
Converts the string to a Key object.
-
#to_message(replaces: nil) ⇒ Message
Converts the string to a Message object.
-
#to_question ⇒ Question
Converts the string to a Question object.
Instance Method Details
#remove_ansi ⇒ String
Removes ANSI escape codes from the string.
15 16 17 |
# File 'lib/utils/string.rb', line 15 def remove_ansi ANSI.remove_from_string(self) end |
#to_key ⇒ Key
Converts the string to a Key object.
22 23 24 |
# File 'lib/utils/string.rb', line 22 def to_key Key.new(self) end |