Module: AmusingGit::PrettyPrinter

Included in:
Amuser, CLI, Config, Setup
Defined in:
lib/amusing_git/pretty_printer.rb

Instance Method Summary collapse

Instance Method Details

#colorize(text, color_code) ⇒ Object



3
4
5
# File 'lib/amusing_git/pretty_printer.rb', line 3

def colorize(text, color_code)
"#{color_code}#{text}\e[0m"
end

#green(text) ⇒ Object



8
# File 'lib/amusing_git/pretty_printer.rb', line 8

def green(text); colorize(text, "\e[32m"); end


15
16
17
# File 'lib/amusing_git/pretty_printer.rb', line 15

def print_error(msg)
  STDOUT.write red(msg)
end


11
12
13
# File 'lib/amusing_git/pretty_printer.rb', line 11

def print_info(msg)
  STDOUT.write yellow(msg)
end


19
20
21
# File 'lib/amusing_git/pretty_printer.rb', line 19

def print_success(msg)
  STDOUT.write green(msg)
end

#red(text) ⇒ Object



7
# File 'lib/amusing_git/pretty_printer.rb', line 7

def red(text); colorize(text, "\e[31m"); end

#yellow(text) ⇒ Object



9
# File 'lib/amusing_git/pretty_printer.rb', line 9

def yellow(text); colorize(text, "\e[1m\e[33m");  end