Created
July 17, 2012 00:05
-
-
Save mattwildig/3126013 to your computer and use it in GitHub Desktop.
Using Rack::Builder without eval-ing block in another context.
This file contains hidden or 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 'rack' | |
require 'forwardable' | |
class MyApp | |
extend Forwardable | |
def_delegators :@builder, :use, :map, :run, :call | |
def initialize | |
@builder = Rack::Builder.new | |
map '/route1' do | |
run SampleApp.new | |
end | |
map '/route2' do | |
run SampleApp.new | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment