Sha256: 78bf5f0fba72cb49dd20dc97cb49a5217a4c1ee44f714f3c5dd3b6cb23593179

Contents?: true

Size: 938 Bytes

Versions: 188

Compression:

Stored size: 938 Bytes

Contents

# encoding: utf-8
module Rack #:nodoc:
  module Mongoid #:nodoc:
    module Middleware #:nodoc:

      # This middleware contains the behaviour needed to properly use the
      # identity map in Rack based applications.
      class IdentityMap

        # Initialize the new middleware.
        #
        # @example Init the middleware.
        # IdentityMap.new(app)
        #
        # @param [ Object ] app The application.
        #
        # @since 2.1.0
        def initialize(app)
          @app = app
        end

        # Make the request with the provided environment.
        #
        # @example Make the request.
        # identity_map.call(env)
        #
        # @param [ Object ] env The environment.
        #
        # @return [ Array ] The status, headers, and response.
        #
        # @since 2.1.0
        def call(env)
          ::Mongoid.unit_of_work { @app.call(env) }
        end
      end
    end
  end
end

Version data entries

188 entries across 96 versions & 4 rubygems

Version Path
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.9/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.10/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.7/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.9/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.10/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.7/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.10/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.7/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.9/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.7/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.10/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.9/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.7/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.10/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.9/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.7/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.10/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.9/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.1 vendor/bundle/gems/mongoid-2.4.10/lib/rack/mongoid/middleware/identity_map.rb
classiccms-0.5.1 vendor/bundle/gems/mongoid-2.4.9/lib/rack/mongoid/middleware/identity_map.rb