Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Interesting Ruby Tidbits That Don’t Need Separate Posts #28

By Peter Cooper / September 9, 2009

lucky-dip-shoe-anim.gifWelcome to the latest in the series of random Ruby related links I've picked up over the past few weeks. It's a crazy grab-bag of links this time around! Whatever your job, interest, or fetish, there's bound to be something in here that tickles your fancy if you're a Rubyist. Enjoy!

Note: Don't forget that if you like quick-fire links like this, check out our sister site RubyFlow. There are usually anywhere between 3 and 15 Ruby and Rails related links each day coming from developers just like you :)

eval Isn't Quite Pure Evil

James Edward Gray II looks at a case where he used eval and got chastized for it. He then notes that eval isn't necessarily always evil and that our reactions to seeing it in code might be a little quick off the mark.

Sketches - Have Editor-Based Ruby Code Reloaded By IRB Automaticallysketches.png

Sketches is a Ruby tool (available as a gem - gem install sketches) that lets you create and edit Ruby code in your favorite text editor while having it safely reloaded in IRB whenever the code is saved/updated. If you're a bit braver, though, check out Hijack, which gets you a live IRB prompt for any existing Ruby process.

Sumo - One-Off Amazon EC2 Instance Launcheramazonec2.png

Sumo (or GitHub repo) is a cute little Ruby-powered command line app to quickly launch and manage Amazon EC2 instances. As an aside, the code provides a small and well formed example of building a command line app around Thor. (If you need something more intense, check out PoolParty, which can manage whole clusters of EC2 instances for you.)

On Rake

On Rake is a perfectly formed blog post by John Barnette about rake (Ruby's "make"). In it he claims most people use Rake simply as a tool to launch tasks (which is true, in my experience) but then quickly demonstrates how Rake's dependency resolution features can radically improve the code you use to define those tasks.

FakeFS - Transparently Get A Fake Filesystem For Ruby

FakeFS is a Ruby library by GitHub extraordinaire Chris Wanstrath that transparently makes the File, Dir, and FileUtils class use an in-memory "virtual" file system. The main benefit of this is for speeding up (and simplifying) test environments.

Getting Started with MacRuby

Getting Started with MacRuby is a great "walkthrough"-style blog post that explains what MacRuby is (an OS X-focused Ruby implementation), how to get it running and how to test it. This is a great guide. We've previously written about MacRuby on Ruby Inside before, if you want to learn more.

Ruby's Metaprogramming Toolbox

Corban Brook has put together a comprehensive article on metaprogramming in Ruby. The highlight is in its conclusion with the implementation of a "poor man's ActiveRecord" where he rolls an ActiveRecord-lite in less than 50 lines of code.

A Native Callback Object for Ruby 1.8.6/7 (MRI) and Ruby 1.9.2

The guys at MethodMissing have come up with a clever Ruby library that provides a native callback system that offers performance superior to lambdas (though not as fast as regular method dispatch). Some interesting "playing with Ruby's guts" work going on in here.

P2P Using TCP & Ruby

Over two years ago on Ruby Inside, I demonstrated how to "punch" a hole through your firewall using Ruby and UDP. Now, Alex MacCaw demonstrates how to implement a P2P-style system in a similar way but using TCP! This is an interesting tactic and works on the majority (though not all!) of routers. I was delighted to see Alex got the idea from an academic paper - there are some great ideas in papers you can pull across into your Ruby work (my library WhatLanguage was based on some ideas in a paper).


  1. Danny Tatom says:

    Some neat ones in here, I really enjoyed reading "Ruby's Metaprogramming Toolbox." Keep it up, guy.

  2. raggi says:

    methodmissing is Lourens Naudés handle, although the callback idea was inspired (as with a few other things) by ideas we've been discussing at work. Lourens being the legend that he is went and implemented it as a native MRI extension for me :-)

Other Posts to Enjoy

Twitter Mentions