Class: Purdytest::IO
- Inherits:
-
Struct
- Object
- Struct
- Purdytest::IO
- Defined in:
- lib/purdytest.rb
Constant Summary collapse
- COLORS =
Colors stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm
{ :black => 30, :on_black => 40, :red => 31, :on_red => 41, :green => 32, :on_green => 42, :yellow => 33, :on_yellow => 43, :blue => 34, :on_blue => 44, :magenta => 35, :on_magenta => 45, :cyan => 36, :on_cyan => 46, :white => 37, :on_white => 47 }
Instance Attribute Summary collapse
-
#io ⇒ Object
Returns the value of attribute io.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg, *args) ⇒ Object
33 34 35 36 |
# File 'lib/purdytest.rb', line 33 def method_missing msg, *args return super unless io.respond_to?(msg) io.send(msg, *args) end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io
7 8 9 |
# File 'lib/purdytest.rb', line 7 def io @io end |
Instance Method Details
#print(o) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/purdytest.rb', line 22 def print o case o when '.' then io.print "\e[#{COLORS[pass]}m.\e[0m" when 'E' then io.print "\e[#{COLORS[error]}mE\e[0m" when 'F' then io.print "\e[#{COLORS[self.fail]}mF\e[0m" when 'S' then io.print "\e[#{COLORS[skip]}mS\e[0m" else io.print o end end |