Class: Lita::MiddlewareRegistry Private
- Inherits:
-
Object
- Object
- Lita::MiddlewareRegistry
- Extended by:
- Forwardable
- Defined in:
- lib/lita/middleware_registry.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Stores Rack middleware for later use in a Rack::Builder
.
Defined Under Namespace
Classes: MiddlewareWrapper
Instance Method Summary collapse
-
#initialize ⇒ MiddlewareRegistry
constructor
private
A new instance of MiddlewareRegistry.
-
#push(middleware) ⇒ void
(also: #<<)
private
Adds a Rack middleware with no initialization arguments.
-
#use(middleware, *args) { ... } ⇒ void
private
Adds a Rack middleware with initialization argumens.
Constructor Details
#initialize ⇒ MiddlewareRegistry
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MiddlewareRegistry.
13 14 15 |
# File 'lib/lita/middleware_registry.rb', line 13 def initialize @registry = [] end |
Instance Method Details
#push(middleware) ⇒ void Also known as: <<
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Adds a Rack middleware with no initialization arguments.
20 21 22 |
# File 'lib/lita/middleware_registry.rb', line 20 def push(middleware) @registry << MiddlewareWrapper.new(middleware, [], nil) end |
#use(middleware, *args) { ... } ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Adds a Rack middleware with initialization argumens. Uses the same interface as Rack::Builder#use.
31 32 33 |
# File 'lib/lita/middleware_registry.rb', line 31 def use(middleware, *args, &block) @registry << MiddlewareWrapper.new(middleware, args, block) end |