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.
12 13 14 |
# File 'lib/coco/formatter/colored_string.rb', line 12 def initialize(str="") super(str) end |
Instance Method Details
#green ⇒ Object
30 31 32 |
# File 'lib/coco/formatter/colored_string.rb', line 30 def green colorize "\033[32m" end |
#red ⇒ Object
Public: Make a red string.
Returns String ANSIfied in red.
19 20 21 |
# File 'lib/coco/formatter/colored_string.rb', line 19 def red colorize "\033[31m" end |
#yellow ⇒ Object
Public: Make a yellow string.
Returns String ANSIfied in yellow.
26 27 28 |
# File 'lib/coco/formatter/colored_string.rb', line 26 def yellow colorize "\033[33m" end |