Class: Aufgaben::Color
- Inherits:
-
Object
- Object
- Aufgaben::Color
- Defined in:
- lib/aufgaben/color.rb
Class Method Summary collapse
Instance Method Summary collapse
- #green ⇒ Object
-
#initialize(text) ⇒ Color
constructor
A new instance of Color.
Constructor Details
#initialize(text) ⇒ Color
Returns a new instance of Color.
7 8 9 |
# File 'lib/aufgaben/color.rb', line 7 def initialize(text) @text = text end |
Class Method Details
.enabled? ⇒ Boolean
3 4 5 |
# File 'lib/aufgaben/color.rb', line 3 def self.enabled? $stdout.tty? end |
Instance Method Details
#green ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/aufgaben/color.rb', line 11 def green if self.class.enabled? "\e[32m#{@text}\e[0m" else @text end end |