# To run this example: # 1. put this code in a config.ru file # 2. run "shotgun" on the command line (http://github.com/rtomayko/shotgun) # 3. go to http://localhost:9393/ require 'rack/mount' class MoonApp def self.call(env) case env['rack.routing_args'][:action] when 'moon' html = %(Moon | Noir | Boosh
#{env['moon.message']}
) end [200, {'Content-Type' => 'text/html'}, [html]] end end Routes = Rack::Mount::RouteSet.new do |set| set.add_route MoonApp, { :path_info => '/moon' }, { :action => 'moon' }, :moon set.add_route NoirApp, { :path_info => '/noir' }, { :action => 'noir' }, :noir set.add_route MoonApp, { :path_info => '/' }, { :action => 'boosh' }, :boosh set.add_route NoirApp, { :path_info => '/' }, { :action => 'boosh' } end run Routes