class Aufgaben::Color

Public Class Methods

enabled?() click to toggle source
# File lib/aufgaben/color.rb, line 3
def self.enabled?
  $stdout.tty?
end
new(text) click to toggle source
# File lib/aufgaben/color.rb, line 7
def initialize(text)
  @text = text
end

Public Instance Methods

green() click to toggle source
# File lib/aufgaben/color.rb, line 11
def green
  if self.class.enabled?
    "\e[32m#{@text}\e[0m"
  else
    @text
  end
end