aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-10-30 10:48:36 -0300
committerEmilio Tagua <miloops@gmail.com>2010-11-19 19:08:58 -0300
commita84add0c2c4afa86feec94e63f2d17e49269ce31 (patch)
treef9405d719e18a45eccd2d8b70af1b9d0590dcac2 /activesupport/lib
parent7d563f9278a748df001697ee66af73c7761fed29 (diff)
downloadrails-a84add0c2c4afa86feec94e63f2d17e49269ce31.tar.gz
rails-a84add0c2c4afa86feec94e63f2d17e49269ce31.tar.bz2
rails-a84add0c2c4afa86feec94e63f2d17e49269ce31.zip
We don't need to dup key, since only value is weak.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/weak_hash.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/weak_hash.rb b/activesupport/lib/active_support/weak_hash.rb
index 171e38f9d8..d6096e606e 100644
--- a/activesupport/lib/active_support/weak_hash.rb
+++ b/activesupport/lib/active_support/weak_hash.rb
@@ -22,16 +22,9 @@ module ActiveSupport
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