Class: Coco::ColoredString
- Inherits:
-
String
- Object
- String
- Coco::ColoredString
- Defined in:
- lib/coco/formatter/colored_string.rb
Overview
Extend String with ANSI colorization. Do nothing on Windows.
Instance Method Summary collapse
-
#initialize(str = "") ⇒ ColoredString
constructor
A new instance of ColoredString.
- #red ⇒ Object
- #yellow ⇒ Object
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
#red ⇒ Object
13 14 15 |
# File 'lib/coco/formatter/colored_string.rb', line 13 def red colorize "\033[31m" end |
#yellow ⇒ Object
17 18 19 |
# File 'lib/coco/formatter/colored_string.rb', line 17 def yellow colorize "\033[33m" end |