Sha256: ef6628152762a3ea5d66729ea282ced73c35b37ea248e4e67e946a9de41e2dc4
Contents?: true
Size: 573 Bytes
Versions: 1
Compression:
Stored size: 573 Bytes
Contents
module SequelMapper class DirtyMap def initialize(storage) @storage = storage end attr_reader :storage private :storage def load(record) storage.store(hash_key(record), deep_clone(record)) record end def dirty?(record) record_as_loaded = storage.fetch(hash_key(record), :not_found) record != record_as_loaded end private def hash_key(record) deep_clone([record.namespace, record.identity]) end def deep_clone(record) Marshal.load(Marshal.dump(record)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sequel_mapper-0.0.3 | lib/sequel_mapper/dirty_map.rb |