Sha256: a467671aae5b9aa981b2f41d318003382d64f30c667460535c0f1f1ae668a4f8
Contents?: true
Size: 379 Bytes
Versions: 3
Compression:
Stored size: 379 Bytes
Contents
# Thread safe hash class CleanHash class MutexHash MUTEX = Mutex.new def initialize data={} @data ||= data end def [] name @data[name] end def []= name, value MUTEX.synchronize do @data[name] = if value.is_a?(Hash) self.class.new value else value end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clean-hash-0.5.0 | ./lib/clean-hash/types/mutex_type.rb |
clean-hash-0.4.1 | ./lib/clean-hash/mutex_hash.rb |
clean-hash-0.4.0 | ./lib/clean-hash/mutex_hash.rb |