Class: PrideIO
Overview
Show your testing pride!
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io) ⇒ PrideIO
constructor
A new instance of PrideIO.
- #method_missing(msg, *args) ⇒ Object
- #print(o) ⇒ Object
Constructor Details
#initialize(io) ⇒ PrideIO
Returns a new instance of PrideIO.
9 10 11 12 13 14 15 |
# File 'lib/minitest/pride.rb', line 9 def initialize io @io = io # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm @colors = (31..36).to_a @size = @colors.size @index = 0 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg, *args) ⇒ Object
29 30 31 |
# File 'lib/minitest/pride.rb', line 29 def method_missing msg, *args io.send(msg, *args) end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
7 8 9 |
# File 'lib/minitest/pride.rb', line 7 def io @io end |
Instance Method Details
#print(o) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/minitest/pride.rb', line 17 def print o case o when "." then io.print "\e[#{@colors[@index % @size]}m*\e[0m" @index += 1 when "E", "F" then io.print "\e[41m\e[37m#{o}\e[0m" else io.print o end end |