Module: AmazingPrint::Colorize

Included in:
Formatter, Formatters::BaseFormatter
Defined in:
lib/amazing_print/colorize.rb

Instance Method Summary collapse

Instance Method Details

#colorize(str, type) ⇒ Object

Pick the color and apply it to the given string as necessary.




11
12
13
14
15
16
# File 'lib/amazing_print/colorize.rb', line 11

def colorize(str, type)
  str = CGI.escapeHTML(str) if options[:html]
  return str if options[:plain] || !options[:color][type] || !inspector.colorize?

  AmazingPrint::Colors.public_send(options[:color][type], str, options[:html])
end