Module: Nanoc::CLI::ANSIStringColorizer
- Defined in:
- lib/nanoc/cli/ansi_string_colorizer.rb
Overview
A simple ANSI colorizer for strings. When given a string and a list of attributes, it returns a colorized string.
Constant Summary
- MAPPING =
TODO: complete mapping
{ bold: "\e[1m", red: "\e[31m", green: "\e[32m", yellow: "\e[33m", blue: "\e[34m" }
Class Method Summary (collapse)
-
+ (String) c(s, *as)
A string colorized using the given attributes.
Class Method Details
+ (String) c(s, *as)
Returns A string colorized using the given attributes
22 23 24 |
# File 'lib/nanoc/cli/ansi_string_colorizer.rb', line 22 def self.c(s, *as) as.map { |a| MAPPING[a] }.join('') + s + "\e[0m" end |