wbailey/command_line_reporter — pull request #3 by ffmike (2012-01-14 13:54:40+00:00)
Title: Add a NullFormatter class

I added a new formatter, NullFormatter. This formatter eats all its output.

The motivation for this is that I have a bunch of existing code that uses many puts statements for output, but which respects a 'quiet' flag that can be passed to suppress the output. With this new formatter, I can start to transition the existing code to command_line_reporter by initializing this way:

quiet? ? self.formatter = 'null' : self.formatter = 'nested'

This does end up being a pretty substantial change, because to make it work all output has to be sent through the formatters - no more raw puts statements in the top-level class. But I think it's a good one, and it potentially opens the opportunity for a more flexible interpretation of formatters in the future - an EmailFormatter for example.

The second commit here just fixed a trivial typo in an example comment. You probably want that one even if you'd like to pass on the null formatter ;)