class MiniTest::ANSI
Constants
- MAPPING
- TEST_REGEX
Public Class Methods
new(stream=MiniTest::Unit.output)
click to toggle source
Calls superclass method
# File lib/minitest/ansi.rb, line 18 def initialize(stream=MiniTest::Unit.output) super end
use!()
click to toggle source
# File lib/minitest/ansi.rb, line 46 def self.use! MiniTest::Unit.output = new end
Public Instance Methods
print(*args)
click to toggle source
# File lib/minitest/ansi.rb, line 22 def print(*args) char = args.first color = case char when '.'; then :green when 'F'; then :yellow when 'E'; then :red when 'S'; then :cyan else __getobj__.print(*args) return end __getobj__.print(::ANSI[color] + char + ::ANSI[:clear]) end
puts(*args)
click to toggle source
# File lib/minitest/ansi.rb, line 36 def puts(*args) str = args.first if str && (str =~ TEST_REGEX) != nil MAPPING.each do |regex, color| str.gsub!(regex, ::ANSI[color] + "\\0" + ::ANSI[:clear]) end end __getobj__.puts(*args) end