Class: Coco::ColoredString
- Inherits:
-
String
- Object
- String
- Coco::ColoredString
- Defined in:
- lib/coco/formatter/colored_string.rb
Overview
Public: Build String with ANSI colorization. Do nothing on Windows.
Instance Method Summary collapse
- #green ⇒ Object
-
#initialize(str = '') ⇒ ColoredString
constructor
Public: Initialize a new ColoredString object.
-
#red ⇒ Object
Public: Make a red string.
-
#yellow ⇒ Object
Public: Make a yellow string.
Constructor Details
#initialize(str = '') ⇒ ColoredString
Public: Initialize a new ColoredString object.
str - A String.
10 11 12 |
# File 'lib/coco/formatter/colored_string.rb', line 10 def initialize(str = '') super(str) end |
Instance Method Details
#green ⇒ Object
28 29 30 |
# File 'lib/coco/formatter/colored_string.rb', line 28 def green colorize "\033[32m" end |
#red ⇒ Object
Public: Make a red string.
Returns String ANSIfied in red.
17 18 19 |
# File 'lib/coco/formatter/colored_string.rb', line 17 def red colorize "\033[31m" end |
#yellow ⇒ Object
Public: Make a yellow string.
Returns String ANSIfied in yellow.
24 25 26 |
# File 'lib/coco/formatter/colored_string.rb', line 24 def yellow colorize "\033[33m" end |