Class: Coco::ColoredString

Inherits:
String
  • Object
show all
Defined in:
lib/coco/formatter/colored_string.rb

Overview

Extend String with ANSI colorization. Do nothing on Windows.

Instance Method Summary collapse

Constructor Details

#initialize(str = "") ⇒ ColoredString

Returns a new instance of ColoredString.



9
10
11
# File 'lib/coco/formatter/colored_string.rb', line 9

def initialize(str="")
  super(str)
end

Instance Method Details

#redObject



13
14
15
# File 'lib/coco/formatter/colored_string.rb', line 13

def red
  colorize "\033[31m"
end

#yellowObject



17
18
19
# File 'lib/coco/formatter/colored_string.rb', line 17

def yellow
  colorize "\033[33m"
end