class Roda::RodaPlugins::MiddlewareStack::StackPosition

  1. lib/roda/plugins/middleware_stack.rb
Superclass: Object

Represents a specific position in the application’s middleware stack where new middleware can be inserted.

Methods

Public Class

  1. new

Public Instance

  1. use

Public Class methods

new(app, middleware, position)
[show source]
   # File lib/roda/plugins/middleware_stack.rb
22 def initialize(app, middleware, position)
23   @app = app
24   @middleware = middleware
25   @position = position
26 end

Public Instance methods

use(*args, &block)

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.

[show source]
   # File lib/roda/plugins/middleware_stack.rb
31 def use(*args, &block)
32   @middleware.insert(@position, [args, block])
33   @app.send(:build_rack_app)
34   @position += 1
35   nil
36 end