class Guacamole::IdentityMap::Session

The ‘IdentityMap::Session` acts as Rack middleware to reset the {IdentityMap} before each request.

Public Class Methods

new(app) click to toggle source

Create a new instance of the ‘Session` middleware

You must pass an object that responds to ‘call` in the constructor. This will be the called after the `IdentityMap` has been purged.

@param [#call] app Any object that responds to ‘call`

# File lib/guacamole/identity_map.rb, line 27
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source

Run the concrete middleware

This satisfies the Rack interface and will be called to reset the ‘IdentityMap` before each request. In the end the `@app` will be called.

@param [Hash] env The environment of the Rack request @return [Array] a Rack compliant response array

# File lib/guacamole/identity_map.rb, line 38
def call(env)
  Guacamole.logger.debug '[SESSION] Resetting the IdentityMap'
  IdentityMap.reset

  @app.call(env)
end