François Vaux has recently published a Ruby module called Rackable which allows you to make any Ruby object Rack-friendly, providing it with a REST-like interface.
What does this mean? Well, a Rack application is essentially a Ruby object that responds to call(). Rackable just gives your object a call method which uses the Rack environment to dispatch to a method.
So, you just need to include Rackable in your class and implement methods for the the appropriate REST verbs. This means you can create a hello_world.ru file like this:
require ‘rackable’
class HelloWorld
include Rackable
def get()
“Hello, world!”
end
end
run HelloWorld.new