module OutputSilencer

def silence_stdout

def silence_stdout
  original_stdout = $stdout
  new_stdout = IO.new
  new_stdout.extend IO::Writable
  new_stdout.write_proc = ->s{}
  begin
    $stdout = new_stdout
    yield
  ensure
    $stdout = original_stdout
  end
end