Suppress all outputs:
quietly { puts 'this message will not be shown'}
Suppress outputs except error messages (eg STDERR):
silence_stream(STDOUT) do
puts 'This will never be seen'
end
puts 'But this will'
Capture the outputs:
stream = capture(:stdout) { puts 'notice' }
stream # => 'notice'