Class: QueueBus::Middleware::Stack
- Inherits:
-
Object
- Object
- QueueBus::Middleware::Stack
- Defined in:
- lib/queue_bus/middleware.rb
Overview
A stack of middleware. You can modify the stack using the provided helper methods.
Instance Method Summary collapse
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #run(args, &inner) ⇒ Object
- #use(middleware) ⇒ Object
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
22 23 24 |
# File 'lib/queue_bus/middleware.rb', line 22 def initialize @middlewares = [] end |
Instance Method Details
#run(args, &inner) ⇒ Object
30 31 32 |
# File 'lib/queue_bus/middleware.rb', line 30 def run(args, &inner) Runner.new(args: args, stack: @middlewares.dup, inner: inner).call end |
#use(middleware) ⇒ Object
26 27 28 |
# File 'lib/queue_bus/middleware.rb', line 26 def use(middleware) @middlewares << middleware end |