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

On Sun, Feb 20, 2011 at 11:44 AM, Gaba L.
[email protected]wrote:

“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 Mon, Feb 21, 2011 at 01:44, Gaba L. [email protected]
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

write mode

-masdel-

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs