Class: MassiveRecord::ORM::IdentityMap::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/massive_record/orm/identity_map.rb

Defined Under Namespace

Classes: BodyProxy

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



242
243
244
# File 'lib/massive_record/orm/identity_map.rb', line 242

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



246
247
248
249
250
251
252
# File 'lib/massive_record/orm/identity_map.rb', line 246

def call(env)
  original_identity_map_state = IdentityMap.enabled?
  IdentityMap.enabled = true

  status, headers, body = @app.call(env)
  [status, headers, BodyProxy.new(body, original_identity_map_state)]
end