-
-
Save airy/6cf9840fc1ffa5ebb796 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
class MyApp < Sinatra::Base | |
@@my_app = {} | |
def self.new(*) self < MyApp ? super : Rack::URLMap.new(@@my_app) end | |
def self.map(url) @@my_app[url] = self end | |
class FooController < MyApp | |
map '/foo' | |
get '/' do | |
"foo" | |
end | |
end | |
class BarController < MyApp | |
map '/bar' | |
get '/' do | |
"bar" | |
end | |
end | |
run! if __FILE__ == $0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment