Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## helper define that takes a block def capturedstdout saved = $stdout captured = StringIO.new $stdout = captured begin yield ensure $stdout = saved end captured.string end ## usage out = capturedstdout { # do your stuff that causes stdout output } # now you have STDOUT of the block in 'out' and STDOUT is back to normal
This paste will be private.
From the Design Piracy series on my blog: