From: Yukihiro Matsumoto Date: 2008-09-17T11:55:48+09:00 Subject: Re: Q: IO.read() and IO.write() Hi, In message "Re: Q: IO.read() and IO.write()" on Mon, 15 Sep 2008 13:17:56 +0900, kwatch writes: |I have questions about IO and File class. | |* Why is IO.read(filename) defined? | IMO, File.read() is more natural than IO.read() because | IO class is not related to filename, I think. No big reason. Historically IO works on files, i.e. IO.open(path), so that it was natural to provide these methods in IO too. |* Is there any reason that IO.write() (or File.write()) is not |provided? | I have to define File.write() for each project... | It is easy to define File.write() but I hope it is provided by Ruby. For File.read(), when you want to specify file mode, you can just say: File.read(path, "rb") For File.write(), it is more likely to be: File.write(path, str, "wb") which makes me feel weird. In 1.9, we can write File.write(path, str, mode: "wb") which I feel slightly better. matz.