module Nanoc::CLI::ANSIStringColorizer
A simple ANSI colorizer for strings. When given a string and a list of attributes, it returns a colorized string.
@api private
Constants
- MAPPING
TODO: complete mapping
Public Class Methods
c(str, *attrs)
click to toggle source
@param [String] str The string to colorize
@param [Array] attrs An array of attributes from `MAPPING` to colorize the
string with
@return [String] A string colorized using the given attributes
# File lib/nanoc/cli/ansi_string_colorizer.rb, line 25 def self.c(str, *attrs) attrs.map { |a| MAPPING[a] }.join('') + str + "\e[0m" end