Sha256: fa6509a5d2baf7a8988aad58bd717680c0fff265eb3ea9c16fbb4328946831c8
Contents?: true
Size: 504 Bytes
Versions: 1
Compression:
Stored size: 504 Bytes
Contents
module Del class Repository def initialize(storage = {}) @storage = storage @lock = Mutex.new end def [](id) find_by(id) end def find_by(id) @lock.synchronize { Del::User.new(id, @storage[id.to_s]) } end def find_all @lock.synchronize { @storage.keys } end def upsert(id, attributes = {}) Del.logger.debug([id, attributes].inspect) @lock.synchronize do @storage[id.to_s] = attributes end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
del-0.1.14 | lib/del/repository.rb |