Module: Ripl::ColorError

Defined in:
lib/ripl/color_error.rb

Constant Summary collapse

VERSION =
'0.1.1'
COLORS =
{:red=>31, :green=>32, :yellow=>33, :blue=>34, :purple=>35, :cyan=>36}

Instance Method Summary collapse

Instance Method Details

#format_error(error) ⇒ Object



8
9
10
11
12
# File 'lib/ripl/color_error.rb', line 8

def format_error(error)
  color_code = config[:color_error].to_s[/^[\d;]+$/] || !config[:color_error] ?
    config[:color_error] : COLORS[config[:color_error].to_sym]
  color_code ? "\e[#{color_code}m#{super}\e[m" : super
end