Sha256: d8b4017f03e6de288bbc35955180a2a805d78b003d58b88b12beda917d4bbd7b
Contents?: true
Size: 350 Bytes
Versions: 56
Compression:
Stored size: 350 Bytes
Contents
module StdoutCapture # Captures stdout within the block # Usage: # # out = capture_stdout do # puts "this will not be shown" # end # out.should == "this will not be shown" def capture_stdout(&block) out = StringIO.new $stdout = out yield out.rewind return out.read ensure $stdout = STDOUT end end
Version data entries
56 entries across 56 versions & 2 rubygems