Sha256: d8492f85a77cc4fff5bc601aaebaa8a4ebe673a4c4c8fb17c62adb5b87c51495
Contents?: true
Size: 484 Bytes
Versions: 10
Compression:
Stored size: 484 Bytes
Contents
# -*- encoding: utf-8 -*- module Coco # Extend String with ANSI colorization. # Do nothing on Windows. class ColoredString < String def initialize(str="") super(str) end def red colorize "\033[31m" end def yellow colorize "\033[33m" end private def colorize color_code if RUBY_PLATFORM =~ /win32/ self else "#{color_code}#{self}\033[0m" end end end end
Version data entries
10 entries across 10 versions & 1 rubygems