Module: Mongo::Model::IdentityMap

Defined in:
lib/mongo/model/identity_map.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clearObject



36
# File 'lib/mongo/model/identity_map.rb', line 36

def clear; models.collect(&:identity_map).every.clear end

.modelsObject



32
33
34
# File 'lib/mongo/model/identity_map.rb', line 32

def models
  @models ||= Set.new
end

Instance Method Details

#originalObject



6
7
8
9
10
11
12
# File 'lib/mongo/model/identity_map.rb', line 6

def original
  unless _cache[:original_cached]
    _cache[:original_cached] = true
    _cache[:original] = id && self.class.get_from_identity_map(id)
  end
  _cache[:original]
end