Module: Karafka::Helpers::Colorize

Included in:
Cli::Install, Cli::Server, Cli::Topics
Defined in:
lib/karafka/helpers/colorize.rb

Overview

Simple wrapper for adding colors to strings

Instance Method Summary collapse

Instance Method Details

#green(string) ⇒ String

Returns green string.

Parameters:

  • string (String)

    string we want to have in green

Returns:

  • (String)

    green string



9
10
11
# File 'lib/karafka/helpers/colorize.rb', line 9

def green(string)
  "\033[0;32m#{string}\033[0m"
end

#red(string) ⇒ String

Returns red string.

Parameters:

  • string (String)

    string we want to have in red

Returns:

  • (String)

    red string



15
16
17
# File 'lib/karafka/helpers/colorize.rb', line 15

def red(string)
  "\033[0;31m#{string}\033[0m"
end

#yellow(string) ⇒ String

Returns yellow string.

Parameters:

  • string (String)

    string we want to have in yellow

Returns:

  • (String)

    yellow string



21
22
23
# File 'lib/karafka/helpers/colorize.rb', line 21

def yellow(string)
  "\033[1;33m#{string}\033[0m"
end