Module: Makitzo::Logging::Colorize

Included in:
Collector
Defined in:
lib/makitzo/logging/colorize.rb

Instance Method Summary collapse

Instance Method Details

#bold(text) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/makitzo/logging/colorize.rb', line 3

def bold(text)
  if use_color?
    "\033[1m#{text}\033[0m"
  else
    text
  end
end

#colorize(text, ansi, bold = false) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/makitzo/logging/colorize.rb', line 11

def colorize(text, ansi, bold = false)
  if use_color?
    code = "\033["
    code << "1;" if bold
    code << "#{ansi}m"
    code + text + "\033[0m"
  else
    text
  end
end