From: Suraj Kurapati Date: 2009-02-01T05:46:57+09:00 Subject: [ruby-core:21701] [Feature #1081] add File::write() convenience method Feature #1081: add File::write() convenience method http://redmine.ruby-lang.org/issues/show/1081 Author: Suraj Kurapati Status: Open, Priority: Normal Category: core, Target version: 1.9.2 Please add a File::write() convenience method to the core Ruby API. Currently, it is easier to read whole files than to write them: # reading a whole file --- less effort text = File::read('foo.txt') # writing a whole file --- more effort File::open('foo.txt', 'wb') {|f| f.write 'ruby!' } This imbalance can be corrected by adding a File::write method, such as the following, to the core Ruby API: class File def self.write path, data, mode = 'wb' open(path, mode) {|f| f.write data } end end Thanks for your consideration. ---------------------------------------- http://redmine.ruby-lang.org