Class | ANSI::String |
In: |
lib/ansi/string.rb
|
Parent: | Object |
IMPORTANT! ANSI::String is experimental!!!
ANSI::String stores a regular string (`@text`) and an associative array that ties a character index to an ANSI code (`marks`). For example is we have the string:
"Big Apple"
And applied the color red to it, the marks list would be:
[[0, :red], [9, :clear]]
TODO: In the future we may be able to subclass String, instead of delegating via @text, but not until it is more compatible.
CLR | = | ANSI::Code::CLEAR |
marks | [R] | |
text | [R] |
This is more limited than the normal String method. It does not yet support a block, and replacement won‘t substitue for \1, \2, etc.
TODO: block support.