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

Author Archives: Peter Cooper

By Peter Cooper / July 3, 2006

Flickr.rb is an ‘insanely easy’ Ruby library to interface with the world’s most popular photo-sharing service, Flickr.

Here’s some example code: Read More

require ‘flickr’

# basics
flickr = # create a flickr client
flickr.login(email, password) # log in for actions that require it
flickr.users # get all users currently online # get the 100 most recent public photos
flickr.tag(‘red’) # search for photos tagged with ‘red’
flickr.groups # get all active public groups

# working with users
user = flickr.users(‘sco’) # lookup a user by username
user = flickr.users(‘’) # or email # get the user’s real name
user.location # and location # grab their collection of Photo objects…

By Peter Cooper / July 2, 2006

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. Read More

By Peter Cooper / July 1, 2006

Mauricio Fernandez’s ever-mindblowing Eigenclass presents a great article about how to easily implement a plugin system for any Ruby application. Ruby’s reflection and OO features make it a cinch. Read More

By Peter Cooper / July 1, 2006

Paul Cantrell has created a cool guide, with demonstrations, of the powers, quirks, and surprises of closures, blocks, and procs in Ruby. He writes:

A closure is a block of code which meets three criteria:

* It can be passed around as a value and

* executed on demand by anyone who has that value, at which time

* it can refer to variables from the context in which it was created (i.e. it is closed with respect to variable access).

Closures are a mainstay of functional languages, but are present in many other languages as well (e.g. Java’s anonymous inner classes). Read More

By Peter Cooper / July 1, 2006

The contracts have finally all been signed and I’m (Peter Cooper) already several chapters into writing a new Ruby book, Beginning Ruby, for APress. The information will probably go live on their site sometime in the next few weeks, but you’ve heard it here first.

The book is anticipating the continuing rise of Ruby, to the point where hundreds of thousands of developers begin learning it separate from Rails, or where it becomes a popular language for totally new programmers. I don’t think we’re quite there yet, but it’s going to happen. At that point, Beginning Ruby will provide a ‘from the beginning’ guide to Ruby, object orientation, development practices, the Ruby community, and so on. Read More

By Peter Cooper / June 30, 2006


Promoting companies is not going to become a regular thing on Ruby Inside, but Guruza struck me as quite interesting. It’s a Google Answers style site but in a Web 2.0 vein. Interestingly, though, there are quite a few people asking and answering Ruby questions on there (whereas I’ve found other questions sites to be thin on programming stuff). Check out the latest Ruby questions. People asking questions specify an amount in dollars of how much they’d pay for an answer, and if you satisfactorily answer the question, the money is yours.

If the smell of money makes your head spin, then there’s always Rails Weenie, a pretty amazing, free, Rails questions and answers system managed by Rails god Rick Olson. Read More

By Peter Cooper / June 30, 2006

Sending mail from Rails applications using sendmail or a normal SMTP daemon is easy, but GMail has posed some problems. Luckily, someone has worked it out and presents code on how to get ActionMailer sending through a GMail account. Read More

By Peter Cooper / June 29, 2006

I initially thought there was only one PayPal library for Ruby, but apparently not. Here’s all those I’ve found:

Paypal by Tobias Luetke – Primarily developed to help integrate PayPal with Rails applications. It works with PayPal’s IPNs (Instant Payment Notifications). Source code demonstrations included.

VPayPal – A new library (released February 2006) that supports both Express Checkout API and the direct checkout API.

RoR::PayPal – A library developed by ELC Technologies and made available under the LGPL. It doesn’t seem to support the Express Checkout API but presents another option and has a detailed README.

Testing PayPal Web Services with Ruby soap4r – This isn’t a library but Pranav Bihari looks at the internals of talking between Ruby and PayPal. Read More

By Peter Cooper / June 29, 2006


The official API documentation for Rails is focused on the last official release, but what about all of us using Edge Rails? The Caboose has a set of documentation for edge Rails, with even ‘hidden’ ‘nodoc’-ed methods included. This is perfect if you’re digging around for bugs or looking for old, deprecated methods. It’s updated three times a day from the latest Edge Rails code. Read More

By Peter Cooper / June 28, 2006

I don’t know much about Oracle, but many people have asked about Ruby’s support for Oracle. One of my clients is also attempting a project with Rails and Oracle. Here are some useful resources I’ve found:

Starting with Ruby and Oracle : A pretty comprehensive and up to date tutorial about using Oracle with Ruby. The tutorial is written from a Windows perspective.

Ruby/OCI8 (Oracle Call Interface) : A library that provides an interface between Ruby and Oracle 8.

Ruby Oracle 7 library : An alternative for Oracle 7 users.

Ruby and Oracle : A basic tutorial to setting up Ruby and Ruby’s Oracle bindings on a Hewlett Packard UNIX based machine. Read More

By Peter Cooper / June 27, 2006

Cobra vs Mongoose is a Ruby library by Paul Battley that makes it easy to convert between XML and Ruby hashes (in both directions). It’s a good alternative to YAML or JSON. It’s available as a gem with gem install -r cobravsmongoose. Here’s some demonstration code:

require ‘rubygems’
require_gem ‘cobravsmongoose’
require ‘cobravsmongoose’

xml = %q{
<person age="10">Bert</person>

puts CobraVsMongoose.xml_to_hash(xml).inspect

# => {"people"=>{"person"=>[{"$"=>"Fred"}, {"$"=>"Chris"}, {"@age"=>"10", "$"=>"Bert"}]}}

You can combine this with the JSON library to convert from XML to hash to JSON, meaning you can convert between all three formats. Read More

By Peter Cooper / June 27, 2006

Chris Williams looks at David Heinemeier Hansson’s keynote speech at last weekend’s RailsConf in Chicago and examines what David has to say about Rails 1.2 (scroll down half a page when you get there).

Other than toys like clever find conditions in Rails without SQL and specifying response types in the URL, you’ll be able to look forward to some extreme REST goodies where Rails can route certain HTTP verbs directly to controller actions (e.g. a DELETE HTTP request would route to ‘destroy’, POST would route to ‘create’, etc) and the ability to pull data from other applications natively with ActiveResource (I’ve hacked my own dirty version of this into apps I’ve developed, and this will be a life saver). Read More

By Peter Cooper / June 27, 2006

Streamlined is a framework that sits about Ruby on Rails and makes developing Rails applications even quicker than possible with scaffolding alone. It includes a ton of useful stuff like pre-built layouts, a REST layer around all the models, support for Atom, and its own DSL. As developer Justin Gehtland explains:

Streamlined is an open source framework for quickly creating data-centric applications with Ruby on Rails. We’ve been using Rails and Ruby to build applications for our customers for going on two years now. Over time, we’ve realized that, like in just about every development platform before, we spent a lot of our time building and rebuilding the same stuff. Read More

By Peter Cooper / June 26, 2006

Slingshot is just one of many hosting companies getting on the Rails bandwagon. Unlike many, though, Slingshot was launched specifically with Rails in mind, as the tagline says: “When we couldn’t find a reliable Rails host, we created our own.” If you use the service and have any comments or a review, do post in comments here. Read More

By Peter Cooper / June 25, 2006

I know.. PHP. Don’t stone me just yet! Eric Rollins presents some interesting work relating to generating PHP code with Ruby.

It’s very much opposite to the whole way Rails works. You supply the system with XML files describing your schema and database setup, and the Ruby scripts pump out PHP files to produce a ‘scaffolded’ type application that can work with the data. The results are very similar to basic Rails scaffolding, but in PHP. The source code for the code generator is available for free download. Read More