From: Seth Thomas Rasmussen Date: 2006-07-13T22:10:05+09:00 Subject: Re: Appending to a CSV file Sorry about my last post sort of skipping over the whole matter of the write mode.. you're smarter than me, though, I'm sure you'll be fine. ;-p Bil Kleb wrote: > ChrisH wrote: > > Bil Kleb wrote: > > ... > >> She says that she can't figure out how to /append/ > >> to a CSV file using Ruby's standard library. > > ... > > > > Wouldn't it just be a matter of opening the file in append mode? > > It would, but unfortunately CSV doesn't support 'a' > or 'a+', viz, lib/ruby/1.8/csv.rb, > > 83 def CSV.open(path, mode, fs = nil, rs = nil, &block) > 84 if mode == 'r' or mode == 'rb' > 85 open_reader(path, mode, fs, rs, &block) > 86 elsif mode == 'w' or mode == 'wb' > 87 open_writer(path, mode, fs, rs, &block) > 88 else > 89 raise ArgumentError.new("'mode' must be 'r', 'rb', 'w', or 'wb'") > 90 end > 91 end > > Later, > -- > Bil > http://fun3d.larc.nasa.gov