Class String
In: lib/drydock/mixins/string.rb
Parent: Object

Methods

Public Class methods

Public Instance methods

bgcolor(bgcol = :default)

Alias for bgcolour

Shortcut for att(:bright)

color(col, bgcol = nil, attribute = nil)

Alias for colour

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"
noansi()

Alias for noatt

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

Print the string at x y. When minus is any true value the length of the string is subtracted from the value of x before printing.

[Validate]