Last active
December 25, 2017 09:57
-
-
Save willnet/cd6189e24d37ca96b43fad21def64f77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def suppress_stdout | |
original_stdout = $stdout | |
$stdout = File.open(File::NULL, 'w') | |
result = yield | |
ensure | |
$stdout = original_stdout | |
result | |
end | |
module ObjectExt | |
def puts(*args) | |
super(caller) | |
super | |
end | |
end | |
class Object | |
prepend ObjectExt | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment