Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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