跳至内容 跳至搜索

此类用于检测单个中间件的执行。它透明地代理 call 方法并检测方法调用。

方法
C
N

常量

EVENT_NAME = "process_middleware.action_dispatch"
 

类公共方法

new(middleware, class_name)

# File actionpack/lib/action_dispatch/middleware/stack.rb, line 57
def initialize(middleware, class_name)
  @middleware = middleware

  @payload = {
    middleware: class_name,
  }
end

实例公共方法

call(env)

# File actionpack/lib/action_dispatch/middleware/stack.rb, line 65
def call(env)
  ActiveSupport::Notifications.instrument(EVENT_NAME, @payload) do
    @middleware.call(env)
  end
end