From: Chad Perrin Date: 2007-06-14T06:14:20+09:00 Subject: Re: Learn to Program, by Chris Pine On Thu, Jun 14, 2007 at 06:04:25AM +0900, Tm Bo wrote: > Hello all. Thanks to all the posters who came before me! You've been > tremendous help. I have a quick question on Chapter 11 - Reading and > Writing, Section 11.3: > > > file_name = 'TestFile.txt' > test_string = 'Nothing!' > > File.open file_name, 'w' do |f| > f.write test_string > end > > read_string = File.read file_name > puts(read_string == test_string) > > > I poked around the web, but I can't find out what the 'w' is for. Can > anyone shed any light? Muchas gracias in advance. Check out this page: http://www.rubycentral.com/book/ref_c_file.html Looking at it, I see that File.open is sometimes a synonym for File.new, so I checked File.new, and that's where I found documentation of the use of characters in that position in the method call. The w itself basically means "write". It refers to how you open the file (for reading, writing, or both). Hopefully this gives you a helpful start on figuring out the rest of the details of how File.new and File.open work. I was surprised to find that File.open isn't in my local ri database, though. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Patrick J. LoPresti: "Emacs has been replaced by a shell script which 1) Generates a syslog message at level LOG_EMERG; 2) reduces the user's disk quota by 100K; and 3) RUNS ED!!!!!!"