diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-14 10:25:29 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-14 10:25:29 +0100 |
commit | 3da9a08a7367eb389ddc03159bfbe5e9a8416e20 (patch) | |
tree | 410081cbb05186077025a1b587a26a2d5f1b2a61 | |
parent | c8f1aac76196bdea8e1fe84a69f0b08c2372c533 (diff) | |
download | rails-3da9a08a7367eb389ddc03159bfbe5e9a8416e20.tar.gz rails-3da9a08a7367eb389ddc03159bfbe5e9a8416e20.tar.bz2 rails-3da9a08a7367eb389ddc03159bfbe5e9a8416e20.zip |
Optimize DetailsKey generation.
-rw-r--r-- | actionpack/lib/action_view/lookup_context.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 22ab076b59..8eb17bf8f1 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -38,17 +38,18 @@ module ActionView register_detail(:locale) { [I18n.locale] } class DetailsKey #:nodoc: - attr_reader :details alias :eql? :equal? + alias :object_hash :hash + attr_reader :hash @details_keys = Hash.new def self.get(details) - @details_keys[details] ||= new(details) + @details_keys[details] ||= new end - def initialize(details) - @details, @hash = details, details.hash + def initialize + @hash = object_hash end end |