How to create a Ruby extension in C in 43 seconds
Two months ago, I wrote How to Create a Ruby Extension in C in under 5 minutes. But times have changed!

Two months ago, I wrote How to Create a Ruby Extension in C in under 5 minutes. But times have changed!
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.


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.
Tomasz Węgrzanowski (aka Taw) has developed a Lisp interpreter embedded in Ruby called RLisp. It's early days and ultra-alpha-quality, but it's a cool project. You can find the source code here, and Taw is offering free beer for the first 10 developers to write a cool RLisp program. RLisp already has some basic OO support (and even HTTP support) so it's fun to play with.
_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:




Alex MacCraw has been working on a great plugin called Juggernaut, and has now made his first public release:

This one is for Mac users only..


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.

The indefatigable Assaf Arkin has done it again by developing a new Ruby HTML scraping toolkit, scrAPI. Peter Szinek recently wrote a popular article about scraping from Ruby using Manic Miner, RubyfulSoup, REXML, and WWW::Mechanize, but none of these are as immediately useful as scrAPI.. so why?
This library is so amazingly cool that it requires no descriptions beyond these code examples:





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.

Ruby legend whytheluckystuff has developed a new HTML parser called Hpricot. It's easy to install and use and parses HTML in a liberal fashion. It does, however, require a compiler to install (as it's written in C), so should be okay on Linux and Mac OS X, though not necessarily on Windows (yet).
DevX.com has published a great article by Mark Watson entitled "Ruby Programming Language Enables Concise Network Programming". Mark gives quick rationales and examples for:
Flickr.rb is an 'insanely easy' Ruby library to interface with the world's most popular photo-sharing service, Flickr.
TeensyMud is a simple MUD (multi-user dungeon - a bit like a text adventure) server written in Ruby. It's not particularly complex, but it has a great structure and there's a lot to learn from looking at the code (patterns are well used). It's also ripe for extending and for building, perhaps, a proper game or full multi-user environment on.