This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: IO.writev for Ruby
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Thanks to Eric Wong, the io-extra library (gem install io-extra) now has the IO.writev method. This allows you to perform "gather writes", i.e. the ability to write an array of strings as a single string.
This might be useful for you if you have a large array of strings that you want to write to a file. By using IO.writev you avoid an unnecessary call to Array#join (and the memory that would consume), or a large number of calls to IO#write.