Sha256: 7707e35d93d9a35dcace0a030ff6bb6e49bf1d62e0bcc265a1160e09ce3ff552
Contents?: true
Size: 820 Bytes
Versions: 24
Compression:
Stored size: 820 Bytes
Contents
# encoding: utf-8 module RuboCop module Formatter # This mix-in module provides string coloring methods for terminals. # It automatically disables coloring if coloring is disabled in the process # globally or the formatter's output is not a terminal. module Colorizable def rainbow @rainbow ||= begin rainbow = Rainbow.new rainbow.enabled = false unless output.tty? rainbow end end def colorize(string, *args) rainbow.wrap(string).color(*args) end [ :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white ].each do |color| define_method(color) do |string| colorize(string, color) end end end end end
Version data entries
24 entries across 24 versions & 2 rubygems