Sha256: 90944d327d464bf44d96d6e7ea6b8acc01169558d66c9a488bbf12066bb95abb

Contents?: true

Size: 901 Bytes

Versions: 10

Compression:

Stored size: 901 Bytes

Contents

require "concurrent"

module Hanami
  # @api private
  class Configuration
    # Middleware configuration
    # @since 1.2.0
    class Middleware
      # @api private
      # @since 1.2.0
      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 1.2.0
      #
      # @example
      #   # config/environment.rb
      #   # ...
      #   Hanami.configure do
      #     middleware.use MyRackMiddleware
      #   end
      def use(middleware, *args, &blk)
        @middleware.push([middleware, args, blk])
      end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hanami-1.3.5 lib/hanami/configuration/middleware.rb
hanami-1.3.4 lib/hanami/configuration/middleware.rb
hanami-1.3.3 lib/hanami/configuration/middleware.rb
hanami-1.3.2 lib/hanami/configuration/middleware.rb
hanami-1.3.1 lib/hanami/configuration/middleware.rb
hanami-1.3.0 lib/hanami/configuration/middleware.rb
hanami-1.3.0.beta1 lib/hanami/configuration/middleware.rb
hanami-1.2.0 lib/hanami/configuration/middleware.rb
hanami-1.2.0.rc2 lib/hanami/configuration/middleware.rb
hanami-1.2.0.rc1 lib/hanami/configuration/middleware.rb