SBDB::WeakHash: ::Hash statt Hash, da es sonst SBDB::Hash nimmt

This commit is contained in:
Denis Knauf 2010-02-02 14:31:57 +01:00
parent 503eea32fd
commit 950d77bd95

View file

@ -5,10 +5,10 @@ module SBDB
class WeakHash class WeakHash
attr_reader :cache attr_reader :cache
def initialize cache = Hash.new def initialize cache = ::Hash.new
@cache = cache @cache = cache
@key_map = {} @key_map = {}
@rev_cache = Hash.new{|h,k| h[k] = {}} @rev_cache = ::Hash.new{|h,k| h[k] = {}}
@reclaim_value = lambda do |value_id| @reclaim_value = lambda do |value_id|
if @rev_cache.has_key? value_id if @rev_cache.has_key? value_id
@rev_cache[value_id].each_key{|key| @cache.delete key} @rev_cache[value_id].each_key{|key| @cache.delete key}