Created
April 17, 2009 22:05
-
-
Save knzai/97296 to your computer and use it in GitHub Desktop.
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
module Rack | |
class Builder | |
def use(middleware, *args, &block) | |
middleware.instance_variable_set "@rack_builder", self | |
def middleware.rack_builder | |
@rack_builder | |
end | |
@ins << lambda { |app| middleware.new(app, *args, &block) } | |
end | |
def leaf_app | |
@ins.last | |
end | |
end | |
class Flash | |
def initialize(app, opts={}) | |
rack_app = self.class.rack_builder.leaf_app | |
def rack_app.flash | |
env['rack-flash'] | |
end | |
@app, @opts = app, opts | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment