Class: Minitest::RG
- Inherits:
-
Object
show all
- Defined in:
- lib/maxitest/vendor/rg.rb
Constant Summary
collapse
- VERSION =
"5.2.0".freeze
- COLORS =
{
"." => "\e[32m.\e[0m",
"E" => "\e[33mE\e[0m",
"F" => "\e[31mF\e[0m",
"S" => "\e[36mS\e[0m"
}.freeze
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(io, colors = COLORS) ⇒ RG
Returns a new instance of RG.
66
67
68
69
|
# File 'lib/maxitest/vendor/rg.rb', line 66
def initialize io, colors = COLORS
@io = io
@colors = colors
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg, *args) ⇒ Object
88
89
90
91
|
# File 'lib/maxitest/vendor/rg.rb', line 88
def method_missing msg, *args
return super unless io.respond_to? msg
io.send(msg, *args)
end
|
Instance Attribute Details
#colors ⇒ Object
Returns the value of attribute colors.
56
57
58
|
# File 'lib/maxitest/vendor/rg.rb', line 56
def colors
@colors
end
|
#io ⇒ Object
Returns the value of attribute io.
56
57
58
|
# File 'lib/maxitest/vendor/rg.rb', line 56
def io
@io
end
|
Class Method Details
.rg!(bool = true) ⇒ Object
58
59
60
|
# File 'lib/maxitest/vendor/rg.rb', line 58
def self.rg!(bool = true)
@rg = bool
end
|
.rg? ⇒ Boolean
62
63
64
|
# File 'lib/maxitest/vendor/rg.rb', line 62
def self.rg?
@rg ||= false
end
|
Instance Method Details
#print(o) ⇒ Object
71
72
73
|
# File 'lib/maxitest/vendor/rg.rb', line 71
def print o
io.print(colors[o] || o)
end
|
#puts(o = nil) ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/maxitest/vendor/rg.rb', line 75
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
|