Class: Loom::Logger::Styleizer

Inherits:
Object
  • Object
show all
Defined in:
lib/loom/logger.rb

Constant Summary collapse

STYLE_CODES =
{
  :bold => 1,
  :red => 31,
  :green => 32,
  :yellow => 33,
  :blue => 34,
  :pink => 35,
  :light_blue => 36,
  :light_gray => 37,
  :dark_gray => 90
}

Class Method Summary collapse

Class Method Details

.apply(str, *styles) ⇒ Object



128
129
130
131
# File 'lib/loom/logger.rb', line 128

def apply(str, *styles)
  return str unless str
  styles.reduce(str) { |str, style| styleize STYLE_CODES[style], str }
end