diff options
author | Emilio Tagua <miloops@gmail.com> | 2011-02-18 16:05:24 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2011-02-18 16:05:24 -0300 |
commit | d9eb007edf6999d2ad8ba09f9c5f03d1b0cea4e5 (patch) | |
tree | 50a60ef50981bfaf2213ac7c139802a1b26dc42e /activesupport/lib | |
parent | 8052623a3d2092a8ac02a331df61b21163a71c65 (diff) | |
download | rails-d9eb007edf6999d2ad8ba09f9c5f03d1b0cea4e5.tar.gz rails-d9eb007edf6999d2ad8ba09f9c5f03d1b0cea4e5.tar.bz2 rails-d9eb007edf6999d2ad8ba09f9c5f03d1b0cea4e5.zip |
WeakHash is not used, remove it.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/weak_hash.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/activesupport/lib/active_support/weak_hash.rb b/activesupport/lib/active_support/weak_hash.rb deleted file mode 100644 index d6096e606e..0000000000 --- a/activesupport/lib/active_support/weak_hash.rb +++ /dev/null @@ -1,41 +0,0 @@ -module ActiveSupport - if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' - WeakHash = ::Weakling::WeakHash - else - class WeakHash - def initialize(cache = Hash.new) - @cache = cache - @key_map = {} - @rev_cache = Hash.new{|h,k| h[k] = {}} - @reclaim_value = lambda do |value_id| - if value = @rev_cache.delete(value_id) - value.each_key{|key| @cache.delete key} - end - end - end - - def [](key) - value_id = @cache[key] - value_id && ObjectSpace._id2ref(value_id) - rescue RangeError - nil - end - - def []=(key, value) - @rev_cache[value.object_id][key] = true - @cache[key] = value.object_id - @key_map[key.object_id] = key - - ObjectSpace.define_finalizer(value, @reclaim_value) - end - - def clear - @cache.clear - end - - def delete(key) - @cache.delete(key) - end - end - end -end |