I have code that prints to stdout (using puts and/or print).
I’m loading the code from a file (pretty much the way rake handles
rakefiles) and would like to capture the output from the loaded code.
I don’t want to redirect stdout into a file or anywhere else, I need the
output in a string.
puts “Output of meaningful code omitted”
###do some magic to get the stdout from this point on into a string
###do some more magic to put stdout back where it was.