Mr. Neighborly’s Humble Little Ruby Book now available




acts_as_cached is a plugin by Chris Wanstrath, Tim Myrtle, and PJ Hyett that simply allows you to cache any Ruby object in memory (using memcached). Check out the documentation for the full instructions, but if you've got a working memcached server ready and waiting, it's as easy as installing a gem (memcached-client), a plugin (acts_as_cached), and adding 'acts_as_cached' to your model.

HAML is a new template language for Ruby on Rails developed by Hampton Catlin, a Canadian Rails developer. It's a high-level, heavily semantic language that breaks the mold of RHTML and makes it very hard to make markup errors. In a way similar to Python, HAML relies on indentation, which it uses to enforce DOM hierarchy.

Chronic is a natural language (English only, at present, I think) time and date parser written entirely in Ruby. It supports a staggering number of different ways of expressing the date and time. For example:
Chris Wanstrath has put together a 'mix tape' of useful tips and tricks for irb and Rails' script/console. Some great bits and pieces in there, and people are leaving even more tricks and tips in the comments!
Charles Nutter, one of the developers of JRuby, a Ruby implemention running on the JVM, has announced that he and Thomas Enebo are becoming Sun Microsystems employees later this month with the responsibility of working on JRuby full-time!
![]()
Eric Hodel has put together a great guide to optimizing Ruby code with RubyInline and ruby-prof, a code profiler.
def foo 'bar' end module M def foo 'baz' end end puts "should be 'bar': #{foo}" self.dup.instance_eval do extend(M) puts "should be 'baz': #{foo}" end puts "should be 'bar': #{foo}"
Garry Dolley worked out some interesting Ruby-fu to create a temporary execution context on the fly using self.dup.instance_eval. Any other tricks we could use this for?
On the back of Kevin Clark's "Things You Shouldn't Be Doing in Rails", Geoffrey Grosenbach has created a plugin called 'deprecated' that, with a single rake task, will alert you to all of the old and deprecated code in your application. This is perfect for bringing those old applications up to date and will help you catch all of the changes necessary, such as using flash and session instead of @flash and @session, etc.
FileList["**/*.rb"].egrep(Regexp.new(ARGV.first))
Jim Weirich has an interesting blog post about using Rake's 'FileList' class to find files on your hard drive. I've already started to use the example he gives here.. good find!

#!/usr/bin/ruby require 'rubyhp' __END__ <html> <body> <% cgi.params.each do |key, value| %> <%= key %>: <%= value %><br /> <% end %> <% if cgi.params.empty? %> Sorry, please enter some cgi parameters. How about "?foo=baz"? <% end %> </body> </html>
Christopher Cyll has put together a great little example of how to quickly create templated Web pages with Ruby without requiring any frameworks. It relies on CGI, but sometimes that's all you need, and it makes throwing together tiny Ruby-powered Web pages possible as easy as creating a simple PHP page.

Alex Bradbury has developed Ariel, a library that uses predefined examples to work out how to extract information from other documents. It was a Google Summer of Code project and was mentioned by Austin Ziegler. More directly from Alex:
Some readers have checked out the little publicized chatroom that's always been linked to from Ruby Inside, but it's been really flaky. Luckily, however, new Web 2.0 startup, Lingr, provide an absolutely amazing, fast, and easy to use chatroom and I've set it up for Ruby Inside right away.


ar_mailer is a system that automatically queues outgoing mails from Rails applications (using ActionMailer) by placing them into a special database table, to then be handled by a separate process, ar_sendmail. This could be particularly ideal for systems with mass mailing applications or simply as a method to speed up certain requests in your Rails applications since only a single database write is required rather than waiting for an e-mail to finish sending.





Lucas Carlson comes up with a cute trick to make Ruby feel a little more like a prototyped language by allowing you to define methods on a class in real-time through child objects, like so:
Following on from the Parsing XML with REXML using Expat post about using Expat to make REXML faster, Chris Wanstrath e-mailed me to let me know about his co-worker PJ's post, "Parse XML with Hpricot". Hpricot, covered previously in Fast HTML parsing in Ruby with Hpricot, is a fast HTML parser for Ruby written mostly in C by Ruby legend whytheluckystiff.