Is there something like a null-stream in Ruby?

If you want the full behavior of streams, the best is probably to use:

File.open(File::NULL, "w")

Note that File::NULL is new to Ruby 1.9.3; you can use my backports gem:

require 'backports/1.9.3/file/null' # => Won't do anything in 1.9.3+
File.open(File::NULL, "w")          # => works even in Ruby 1.8.6

You could also copy the relevant code if you prefer.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)