Class: Pallets::Middleware::Stack
- Inherits:
-
Array
- Object
- Array
- Pallets::Middleware::Stack
- Defined in:
- lib/pallets/middleware/stack.rb
Overview
Array-like class that acts like a stack and additionally provides the means to wrap an operation with callable objects
Instance Method Summary collapse
Instance Method Details
#invoke(*args, &block) ⇒ Object
6 7 8 9 10 |
# File 'lib/pallets/middleware/stack.rb', line 6 def invoke(*args, &block) reverse.inject(block) do |memo, middleware| lambda { middleware.call(*args, &memo) } end.call end |