Improve my understanding of capture_stdout

This a common pattern found in ruby called toggle_around. It's the same
concept used when we want to do temporarily change the value of
something ($stdout in this case), execute some code within a block and
then ensure the we set $stdout back to it's original value.

I think this is used in rails to handle changing an applications env
from dev to test whilst am testing.