From: James Edward Gray II Date: 2006-04-02T05:39:34+09:00 Subject: [ANN] FasterCSV 0.2.0 -- The user requests release! FasterCSV 0.2.0 Released ======================== FasterCSV has a ton of new features from requests (some even provided patches) by you! It's very hard for me to pick what to show off here, but if I had to pick two favorites it would be using an Array of headers and the new shortcut interface. Since 0.1.6, FasterCSV has allowed named access for columns. Now you can say goodbye to indexes altogether as Dakshinamurthy Karra has sent in a patch allowing you to specify an Array of headers to use for any document. Just setup the headers when you create the instance and it's nothing but names you'll have to worry about from then on. Ara.T.Howard also sent in a patch for a short but powerful interface extension. Check this out: FCSV { |csv_out| csv_out << %w{my data here} } # to STDOUT FCSV(csv = "") { |csv_str| csv_str << %w{my data here} } # to a String FCSV(STDERR) { |csv_err| csv_err << %w{my data here} } # to STDERR You can wrap IO objects with that, change options, or whatever. It also caches the instance so subsequent calls won't invent another FasterCSV object. There's a lot more in this release though, including serialization similar to what Hal Fulton described in his metaprogramming article and a CSV compatibility layer for easy transitioning. If you work with CSV data, you want to download this release, trust me! What is FasterCSV? ------------------ (from the README) FasterCSV is intended as a replacement to Ruby's standard CSV library. It was designed to address concerns users of that library had and it has three primary goals: 1. Be significantly faster than CSV while remaining a pure Ruby library. 2. Use a smaller and easier to maintain code base. (We're about even now, but not if you compare the features!) 3. Improve on the CSV interface. What's New? ----------- (highlights from the CHANGELOG) * Made FasterCSV#lineno CSV aware. * Added line numbers to MalformedCSVError messages. * :headers can now be set to an Array of headers to use. * :headers can now be set to an external CSV String of headers to use. * Added an :unconverted_fields options, so those can be returned when needed. * Provided support for the serialization of custom Ruby objects using CSV. * Added CSV drop-in interface. * Added header information to FieldInfo Struct for conversions by header. * Added an alias to support require "fastercsv". * Added FasterCSV::instance and FasterCSV()/FCSV() shortcuts for easy output. Migrating from CSV to FasterCSV? -------------------------------- The README includes a section on the differences and you can read that here: http://fastercsv.rubyforge.org/ You call also see general usage in the documentation of the interface, right here: http://fastercsv.rubyforge.org/classes/FasterCSV.html For quick and dirty switching, try: begin require "faster_csv" FasterCSV.build_csv_interface rescue LoadError require "csv" end # ... use CSV here ... If FasterCSV isn't meeting your needs, I want to here about it: james@grayproductions.net Where can I learn more? ----------------------- FasterCSV is hosted on RubyForge. Project page: http://rubyforge.org/projects/fastercsv/ Documentation: http://fastercsv.rubyforge.org/ Downloads: http://rubyforge.org/frs/?group_id=1102 How do I get FasterCSV? ----------------------- FasterCSV is a gem, so as long as you have RubyGems installed it's as simple as: $ sudo gem install fastercsv If you need to install RubyGems, you can download it from: http://rubyforge.org/frs/?group_id=126&release_id=2471 FasterCSV can also be installed manually. Just download the latest release and follow the instructions in INSTALL: http://rubyforge.org/frs/?group_id=1102&release_id=4758 James Edward Gray II