Sha256: 83ac31c24d0b06f43e607ef9f7040e6b0edfbf6db8c0e632fe84171ef88fccfb
Contents?: true
Size: 495 Bytes
Versions: 19
Compression:
Stored size: 495 Bytes
Contents
# utility methods totally not edited from StackOverflow class Utils # captures stdout from a block: out = capture_stdout { code } def self.capture_stdout old_stdout = $stdout $stdout = StringIO.new yield $stdout.string ensure $stdout = old_stdout end # captures stderr from a block: err = capture_stderr { code } def self.capture_stderr old_stderr = $stderr $stderr = StringIO.new yield $stderr.string ensure $stderr = old_stderr end end
Version data entries
19 entries across 19 versions & 1 rubygems