Skip to content

Instantly share code, notes, and snippets.

@judofyr
Created October 23, 2009 12:00
Show Gist options
  • Save judofyr/216835 to your computer and use it in GitHub Desktop.
Save judofyr/216835 to your computer and use it in GitHub Desktop.
require 'stringio'
def silent
$stdout = StringIO.new
yield
ensure
$stdout = STDOUT
end
puts "Hello"
silent { puts "Ignore" }
puts "World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment