| Path: | lib/csv.rb |
| Last Update: | Sun Jun 01 19:35:09 -0500 2008 |
Created by James Edward Gray II on 2005-10-31. Copyright 2005 James Edward Gray II. You can redistribute or modify this code under the terms of Ruby's license.
See CSV for documentation.
Welcome to the new and improved CSV.
This version of the CSV library began its life as FasterCSV. FasterCSV was intended as a replacement to Ruby‘s then standard CSV library. It was designed to address concerns users of that library had and it had three primary goals:
Obviously, the last one is subjective. I did try to defer to the original interface whenever I didn‘t have a compelling reason to change it though, so hopefully this won‘t be too radically different.
We must have met our goals because FasterCSV was renamed to CSV and replaced the original library.
I‘m sure I‘ll miss something, but I‘ll try to mention most of the major differences I am aware of, to help others quickly get up to speed:
If you use this library and find yourself missing any functionality I have trimmed, please let me know.
See CSV for documentation.
CSV maintains a pretty strict definition of CSV taken directly from the RFC. I relax the rules in only one place and that is to make using this library easier. CSV will parse all valid CSV.
What you don‘t want to do is feed CSV invalid data. Because of the way the CSV format works, it‘s common for a parser to need to read until the end of the file to be sure a field is invalid. This eats a lot of time and memory.
Luckily, when working with invalid CSV, Ruby‘s built-in methods will almost always be superior in every way. For example, parsing non-quoted fields is as easy as:
data.split(",")
Feel free to email James Edward Gray II with any questions.
ruby-doc.org is hosted and run by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.