Skip to content

Instantly share code, notes, and snippets.

@willnet
Last active December 25, 2017 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willnet/cd6189e24d37ca96b43fad21def64f77 to your computer and use it in GitHub Desktop.
Save willnet/cd6189e24d37ca96b43fad21def64f77 to your computer and use it in GitHub Desktop.
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