Class: HumanistErrors::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/humanist_errors/color.rb

Constant Summary collapse

PREFIX =
'\033'
POSTFIX =
'\033[0m'
COLORS =
{
  black:   '[30m',
  red:     '[31m',
  green:   '[32m',
  brown:   '[33m',
  blue:    '[34m',
  magenta: '[35m',
  cyan:    '[36m',
  gray:    '[37m',
}

Instance Method Summary collapse

Instance Method Details

#colorize_with(color, text) ⇒ Object



16
17
18
# File 'lib/humanist_errors/color.rb', line 16

def colorize_with(color, text)
  "#{PREFIX}#{COLORS[color]}#{text}#{POSTFIX}"
end