Method: Cinch::Helpers#Format

Defined in:
lib/cinch/helpers.rb

#Format(*settings, string) ⇒ String Also known as: Color

Returns the formatted string.

Examples:

Nested formatting, combining text styles and colors

reply = Format(:underline, "Hello %s! Is your favourite color %s?" % [Format(:bold, "stranger"), Format(:red, "red")])

Parameters:

  • settings (Array<Symbol>)

    The colors and attributes to apply. When supplying two colors, the first will be used for the foreground and the second for the background.

  • string (String)

    The string to format.

Returns:

  • (String)

    the formatted string

Raises:

  • (ArgumentError)

    When passing more than two colors as arguments.

See Also:

Since:

  • 2.0.0



183
184
185
# File 'lib/cinch/helpers.rb', line 183

def Format(*settings, string)
  Formatting.format(*settings, string)
end