Make any Ruby object Rack-friendly with Rackable
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
... start it with rackup, and then use something like curl (or even your browser) to call the methods.
Thanks to Alex Young for putting me on to this.