Sha256: 9fc97314ba4536295b7b2adff6aef0d828760dccb30cb623f79b51d8ad3af790

Contents?: true

Size: 1014 Bytes

Versions: 1

Compression:

Stored size: 1014 Bytes

Contents

# frozen_string_literal: true

module Rack
  class BlastWave::RequestId
    # @api private
    # @since 0.1.0
    module Initializer
      # @return [Mutex]
      #
      # @api private
      # @since 0.1.0
      INITIALIZATION_LOCK = Mutex.new

      class << self
        # @param app [Object]
        # @return [void]
        #
        # @see extend_request_interface!
        #
        # @api private
        # @since 0.1.0
        def call(app)
          extend_request_interface!
        end

        private

        # @return [void]
        #
        # @see Rack::BlastWave::RequestId::Extensions::RequestInterface
        #
        # @api private
        # @since 0.1.0
        def extend_request_interface!
          INITIALIZATION_LOCK.synchronize do
            unless Rack::Request.include?(BlastWave::RequestId::Extentions::RequestInterface)
              Rack::Request.prepend(BlastWave::RequestId::Extentions::RequestInterface)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blast_wave-0.0.0 lib/blast_wave/request_id/initializer.rb