Module: Lotus::Action::Rack::ClassMethods
- Defined in:
- lib/lotus/action/rack.rb
Overview
Instance Method Summary collapse
-
#use(middleware) ⇒ Object
Use a Rack middleware as a before callback.
Instance Method Details
#use(middleware) ⇒ Object
Use a Rack middleware as a before callback.
The middleware will be used as it is, no matter if it’s a class or an instance. If it needs to be initialized, please do it before to pass it as the argument of this method.
At the runtime, the middleware be invoked with the raw Rack env.
Multiple middlewares can be employed, just by using multiple times this method.
85 86 87 88 89 |
# File 'lib/lotus/action/rack.rb', line 85 def use(middleware) before do |params| middleware.call(params.env) end end |