class Diva::Model::Memory

Public Class Methods

new(klass=Diva::Model) click to toggle source
# File core/lib/diva_hacks/model/memory.rb, line 4
def initialize(klass=Diva::Model)
  @storage = WeakStorage.new(Integer, klass) end

Public Instance Methods

findbyid(id, policy) click to toggle source
# File core/lib/diva_hacks/model/memory.rb, line 7
def findbyid(id, policy)
  if id.is_a? Enumerable
    id.map{ |i| @storage[i.to_i] }
  else
    @storage[id.to_i] end
end
store_datum(datum) click to toggle source
# File core/lib/diva_hacks/model/memory.rb, line 14
def store_datum(datum)
  @storage[datum.id] = datum
end