Sha256: 98ffe12fe7fcc466255e52912dcf72fa80d82874e0f020a6598a911a6bf5f8f9
Contents?: true
Size: 820 Bytes
Versions: 9
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
9 entries across 9 versions & 1 rubygems