Permalink
Browse files

We don't need to dup key, since only value is weak.

  • Loading branch information...
1 parent 7d563f9 commit a84add0c2c4afa86feec94e63f2d17e49269ce31 @miloops miloops committed Oct 30, 2010
Showing with 3 additions and 10 deletions.
  1. +3 −10 activesupport/lib/active_support/weak_hash.rb
@@ -22,16 +22,9 @@ def [](key)
end
def []=(key, value)
- key2 = case key
- when Fixnum, Symbol, true, false, nil
- key
- else
- key.dup
- end
-
- @rev_cache[value.object_id][key2] = true
- @cache[key2] = value.object_id
- @key_map[key.object_id] = key2
+ @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

0 comments on commit a84add0

Please sign in to comment.