Class: Rack::Mongoid::Middleware::IdentityMap

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/mongoid/middleware/identity_map.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ IdentityMap

Initialize the new middleware.

IdentityMap.new(app)

Examples:

Init the middleware.

Parameters:

  • app (Object)

    The application.

Since:

  • 2.1.0



18
19
20
# File 'lib/rack/mongoid/middleware/identity_map.rb', line 18

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Array

Make the request with the provided environment.

identity_map.call(env)

Examples:

Make the request.

Parameters:

  • env (Object)

    The environment.

Returns:

  • (Array)

    The status, headers, and response.

Since:

  • 2.1.0



32
33
34
# File 'lib/rack/mongoid/middleware/identity_map.rb', line 32

def call(env)
  ::Mongoid.unit_of_work { @app.call(env) }
end