Question about a small piece of code

Hi,

What does the 'w' in the "CSV.open" part of the below code do?

CSV.open('text2.txt','w') do |csv|
  people.each do |person|
    csv <<person

···

--
Posted via http://www.ruby-forum.com/.

"Write-only, truncates existing file to zero length or creates a new file
for writing"

You can see all the options at the top of this page:
http://ruby-doc.org/core/classes/IO.html

···

On Sun, Feb 20, 2011 at 11:44 AM, Gaba Luschi <friedoysterlover@gmail.com>wrote:

Hi,

What does the 'w' in the "CSV.open" part of the below code do?

CSV.open('text2.txt','w') do |csv|
people.each do |person|
   csv <<person

--
Posted via http://www.ruby-forum.com/\.

write mode

-masdel-

···

On Mon, Feb 21, 2011 at 01:44, Gaba Luschi <friedoysterlover@gmail.com> wrote:

Hi,

What does the 'w' in the "CSV.open" part of the below code do?

CSV.open('text2.txt','w') do |csv|
people.each do |person|
csv <<person

--