Module: Acclaim::CoreExtensions::String::ANSI

Defined in:
lib/acclaim/core_extensions/string/ansi.rb

Overview

Object-oriented ANSI escape code API.

See Also:

Author:

  • Matheus Afonso Martins Moreira

Since:

  • 0.5.0

Instance Method Summary collapse

Instance Method Details

#background(color) ⇒ String

Applies background color to this string.

Parameters:

  • color (Symbol)

    the name of the color that will be applied

Returns:

  • (String)

    new string with the color applied

See Also:

Since:

  • 0.5.0



30
31
32
# File 'lib/acclaim/core_extensions/string/ansi.rb', line 30

def background(color)
  Acclaim::ANSI.background_color self, color
end

#effects(*effects) ⇒ String

Applies text effects to this string.

Parameters:

  • effects (Array<Symbol>)

    the text effects to apply

Returns:

  • (String)

    new string with the text effects applied

See Also:

Since:

  • 0.5.0



39
40
41
# File 'lib/acclaim/core_extensions/string/ansi.rb', line 39

def effects(*effects)
  Acclaim::ANSI.effects self, *effects
end

#foreground(color) ⇒ String

Applies foreground color to this string.

Parameters:

  • color (Symbol)

    the name of the color that will be applied

Returns:

  • (String)

    new string with the color applied

See Also:

Since:

  • 0.5.0



20
21
22
# File 'lib/acclaim/core_extensions/string/ansi.rb', line 20

def foreground(color)
  Acclaim::ANSI.foreground_color self, color
end