From 9b552fb300c4606fe517eadaa30708e9d75498a6 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Fri, 14 Aug 2009 12:00:52 -0700 Subject: Caches and cache clearing seems to actually work, but the actual architecture is kind of messy. Next: CLEAN UP. --- actionpack/lib/action_view/template/template.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/template') diff --git a/actionpack/lib/action_view/template/template.rb b/actionpack/lib/action_view/template/template.rb index 8f23f9b9e3..7d6964e3e3 100644 --- a/actionpack/lib/action_view/template/template.rb +++ b/actionpack/lib/action_view/template/template.rb @@ -97,7 +97,22 @@ module ActionView raise ActionView::TemplateError.new(self, {}, e) end end - + + class LocalsKey + @hash_keys = Hash.new {|h,k| h[k] = Hash.new {|h,k| h[k] = {} } } + + def self.get(*locals) + @hash_keys[*locals] ||= new(klass, format, locale) + end + + attr_accessor :hash + def initialize(klass, format, locale) + @hash = locals.hash + end + + alias_method :eql?, :equal? + end + def build_method_name(locals) # TODO: is locals.keys.hash reliably the same? @method_names[locals.keys.hash] ||= -- cgit v1.2.3