Created
September 28, 2008 15:31
-
-
Save mguterl/13473 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 quiet( &block ) | |
io = STDOUT.dup | |
STDOUT.reopen '/dev/null', 'w' | |
block.call | |
STDOUT.reopen io | |
end | |
quiet { puts "hello" } | |
quiet { puts "hello" } # take this out and it works | |
puts "goodbye" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment