Class | String |
In: |
lib/drydock/mixins/string.rb
|
Parent: | Object |
col, bgcol, and attribute are symbols corresponding to Console::COLOURS, Console::BGCOLOURS, and Console::ATTRIBUTES. Returns the string in the format attributes + string + defaults.
"MONKEY_JUNK".colour(:blue, :white, :blink) # => "\e[34;47;5mMONKEY_JUNK\e[39;49;0m"
Returns the string with ANSI escape codes removed.
NOTE: The non-printable attributes count towards the string size. You can use this method to get the "visible" size:
"\e[34;47;5mMONKEY_JUNK\e[39;49;0m".noatt.size # => 11 "\e[34;47;5mMONKEY_JUNK\e[39;49;0m".size # => 31