class Roda::RodaPlugins::MiddlewareStack::StackPosition
Represents a specific position in the application’s middleware stack where new middleware can be inserted.
Public Class Methods
Source
# File lib/roda/plugins/middleware_stack.rb, line 22 def initialize(app, middleware, position) @app = app @middleware = middleware @position = position end
Public Instance Methods
Source
# File lib/roda/plugins/middleware_stack.rb, line 31 def use(*args, &block) @middleware.insert(@position, [args, block]) @app.send(:build_rack_app) @position += 1 nil end
Insert a new middleware into the current position in the middleware stack. Increments the position so that calling this multiple times adds later middleware after earlier middleware, similar to how Roda.use
works.