Expat is the recognized big daddy of XML parsing. It's a stream-based XML parser written in C and, as a library, is used for XML parsing functions by many languages. Rubyists have tended towards REXML, however, a more flexible (though infinitely slower) parser. Sam Ruby, however, has come up with some techniques to get Ruby's REXML working with Expat.
I've joined forces with Obie Fernandez on the Ruby section at InfoQ, a prime news site for the enterprise software development community. The Ruby news at InfoQ has more of an enterprise feel to it than that here at RubyInside and is focused at team leaders, development managers, enterprise developers, etc, so there's less hacking, but more high-level Ruby stuff.
After writing a basic routine to print all prime numbers between 1 and 10,000 in Ruby, Pat Eyler found it took almost 3 seconds to complete, and seeked out a way to make it faster. Enter RubyInline (covered previous at RubyInside).. With RubyInline he added a basic C function into the Ruby mix and knocked down the time required to 0.3 seconds.
It's time to bring in a regular feature.. Troll Of The Month. Every month or so there appears to be a new article circulating that explains why 'Ruby sucks' or why you shouldn't use Rails to develop serious applications. Most of the time, they're unbalanced and poor explained, even if the author has some valid points.
_why announces a release of a new UTF-8 library (which adds UTF-8 support to Ruby, without using KCODE) by Nikolai Weibull. _why has also packaged it up (unofficially) into a gem to make it even easier to install (not all of us use git). Here's some demonstration code:
Bruce Williams tries to solve the problem of multiple parameter types in Rails. For example, an action may accept dates via a parameter, but dates may be supplied in many forms. A 'date' parameter might arrived as if from a date_select helper, or might even be typed in directly by a user, or be pulled from a database. Rather than use before_filters to check parameters and normalize them, Bruce suggests that it should be possible to add basic conversion tools to certain data types so that all data is normalized by the time it hits your controllers.
Active Merchant is a payment processing library for Rails developed by the geniuses behind Rails powered e-commerce system, Shopify. It's under active development with support for different payment processor gateways being added regularly. So far it supports:
There are many scenarios where you might want the same controller action / method in your Rails application to perform multiple functions. For example, a wizard with multiple steps or a single form with multiple-stage AJAX calls. What you want to do is provide a 'context' to the specific request and have the controller handle that in some different way.
Geoffrey Grosenbach introduces the RaPT Plugin Manager for Rails, the answer to the problem of slow plugin installation. Installable as a gem (gem install rapt), RaPT caches the locations of different plugins so that installation is quick and easy. Future plans include developing a central plugin repository, auto-announcement of self-developed plugins, and automatic plugin upgrading. If you want the files direct, check out the Rubyforge project site for RaPT.
You can test your controllers, your models, and, well, most of your application, but till now there hasn't been a way to explicitly test your Rails application's helpers. Now there's a solution.. the helper_test plugin (with source and instructions).
MeantimeFilter is an interesting new plugin for Rails by Roman Le Negrate. It's a little like around_filter, but rather than using a class with 'before' and 'after' methods, it uses a single method (like the other types of filter) and passes in the method to wrap 'around' as a code block. You can then yield to this or pass it into anything you like. An example:
Paul Battley has developed a Ruby to JavaScript converter. I'm trying to think what this is useful for, but this is an amazing results for just a few hours' work.