Sha256: 6adc8f7ccd452cfa61d0e840836a70fe953f6092e878c9fc8f4581f63795c9cc
Contents?: true
Size: 875 Bytes
Versions: 9
Compression:
Stored size: 875 Bytes
Contents
require 'active_support/concern' module Grape module DSL module Middleware extend ActiveSupport::Concern include Grape::DSL::Configuration module ClassMethods # Apply a custom middleware to the API. Applies # to the current namespace and any children, but # not parents. # # @param middleware_class [Class] The class of the middleware you'd like # to inject. def use(middleware_class, *args, &block) arr = [middleware_class, *args] arr << block if block_given? namespace_stackable(:middleware, arr) end # Retrieve an array of the middleware classes # and arguments that are currently applied to the # application. def middleware namespace_stackable(:middleware) || [] end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems