Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new ActionController::Middleware class that will work as a nor…
…mal Rack middleware. * This initial implementation is a bit hackish, but it uses a normal middleware API so it's future-proof when we improve the internals.
- Loading branch information
Showing
9 changed files
with
166 additions
and
110 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,34 @@ | |||
module ActionController | |||
class Middleware < Metal | |||
class ActionMiddleware | |||
def initialize(controller) | |||
@controller = controller | |||
end | |||
|
|||
def call(env) | |||
controller = @controller.allocate | |||
controller.app = @app | |||
controller._call(env) | |||
end | |||
|
|||
def app=(app) | |||
@app = app | |||
end | |||
end | |||
|
|||
def self.new(app) | |||
middleware = ActionMiddleware.new(self) | |||
middleware.app = app | |||
middleware | |||
end | |||
|
|||
def _call(env) | |||
@_env = env | |||
process(:index) | |||
end | |||
|
|||
def index | |||
call(env) | |||
end | |||
end | |||
end |
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
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
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
Oops, something went wrong.