class Minitest::RG

def self.rg!(bool = true)

def self.rg!(bool = true)
  @rg = bool
end

def self.rg?

def self.rg?
  @rg ||= false
end

def initialize io, colors = COLORS

def initialize io, colors = COLORS
  @io     = io
  @colors = colors
end

def method_missing msg, *args

def method_missing msg, *args
  return super unless io.respond_to? msg
  io.send(msg, *args)
end

def print o

def print o
  io.print(colors[o] || o)
end

def puts o = nil

def puts o = nil
  return io.puts if o.nil?
  if o =~ /(\d+) failures, (\d+) errors/
    if Regexp.last_match[1] != "0" || Regexp.last_match[2] != "0"
      io.puts "\e[31m#{o}\e[0m"
    else
      io.puts "\e[32m#{o}\e[0m"
    end
  else
    io.puts o
  end
end