From: Shota Fukumori <sorah@...>
Date: 2011-06-01T11:21:13+09:00
Subject: [ruby-core:36653] [Ruby 1.9 - Feature #1081] add File::write() convenience method


Issue #1081 has been updated by Shota Fukumori.


I want to commit ASAP because we're going to freeze specification, 
so if there aren't any problems, I'll commit patch at http://redmine.ruby-lang.org/issues/1081#note-44 [ruby-core:36630].

I remembered that matz approved this new method with this specification, if not please notify me.
----------------------------------------
Feature #1081: add File::write() convenience method
http://redmine.ruby-lang.org/issues/1081

Author: Suraj Kurapati
Status: Assigned
Priority: Normal
Assignee: Yusuke Endoh
Category: core
Target version: 1.9.3


=begin
 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.
=end



-- 
http://redmine.ruby-lang.org