Class: MongoMapper::Middleware::IdentityMap::Body

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mongo_mapper/middleware/identity_map.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, original) ⇒ Body

Returns a new instance of Body.



15
16
17
18
# File 'lib/mongo_mapper/middleware/identity_map.rb', line 15

def initialize(target, original)
  @target   = target
  @original = original
end

Instance Method Details

#closeObject



20
21
22
23
24
25
# File 'lib/mongo_mapper/middleware/identity_map.rb', line 20

def close
  @target.close if @target.respond_to?(:close)
ensure
  MongoMapper::Plugins::IdentityMap.enabled = @original
  MongoMapper::Plugins::IdentityMap.clear
end