Sha256: 0ac1ebc2fb312273a377b7a2da77db2c56079b9c23919f3fe7671c270c65f9f1

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

require "concurrent"

module Hanami
  # @api private
  class Configuration
    # Middleware configuration
    class Middleware
      # @api private
      def initialize
        @middleware = Concurrent::Array.new
      end

      # Use a Rack middleware
      #
      # @param middleware [#call] a Rack middleware
      # @param args [Array<Object>] an optional set of options
      # @param blk [Proc] an optional block to pass to the middleware
      #
      # @since x.x.x
      #
      # @example
      #   # config/environment.rb
      #   # ...
      #   Hanami.configure do
      #     middleware.use MyRackMiddleware
      #   end
      def use(middleware, *args, &blk)
        @middleware.push([middleware, args, blk])
      end

      # @api private
      def each(&blk)
        @middleware.each(&blk)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanami-1.2.0.beta2 lib/hanami/configuration/middleware.rb
hanami-1.2.0.beta1 lib/hanami/configuration/middleware.rb