Class: MiniTest::RG
- Inherits:
-
Object
show all
- Defined in:
- lib/maxitest/vendor/rg.rb
Constant Summary
collapse
- VERSION =
"5.1.0"
- COLORS =
{
'.' => "\e[32m.\e[0m",
'E' => "\e[33mE\e[0m",
'F' => "\e[31mF\e[0m",
'S' => "\e[36mS\e[0m",
}
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.
64
65
66
67
|
# File 'lib/maxitest/vendor/rg.rb', line 64
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
86
87
88
89
|
# File 'lib/maxitest/vendor/rg.rb', line 86
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.
54
55
56
|
# File 'lib/maxitest/vendor/rg.rb', line 54
def colors
@colors
end
|
#io ⇒ Object
Returns the value of attribute io.
54
55
56
|
# File 'lib/maxitest/vendor/rg.rb', line 54
def io
@io
end
|
Class Method Details
.rg! ⇒ Object
56
57
58
|
# File 'lib/maxitest/vendor/rg.rb', line 56
def self.rg!
@rg = true
end
|
.rg? ⇒ Boolean
60
61
62
|
# File 'lib/maxitest/vendor/rg.rb', line 60
def self.rg?
@rg ||= false
end
|
Instance Method Details
#print(o) ⇒ Object
69
70
71
|
# File 'lib/maxitest/vendor/rg.rb', line 69
def print o
io.print(colors[o] || o)
end
|
#puts(o = nil) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/maxitest/vendor/rg.rb', line 73
def puts o=nil
return io.puts if o.nil?
if o =~ /(\d+) failures, (\d+) errors/
if $1 != '0' || $2 != '0'
io.puts "\e[31m#{o}\e[0m"
else
io.puts "\e[32m#{o}\e[0m"
end
else
io.puts o
end
end
|