Permalink
Browse files

Removed TemplateFinder.update_extension_cache_for since view path cac…

…he will be updated on boot.
  • Loading branch information...
1 parent 55791c6 commit 233643047104131565467787d0bbc0841bbc77cb @josh josh committed Jun 9, 2008
@@ -99,7 +99,6 @@ def raise_missing_template_exception
# return the rendered template as a string.
def self.register_template_handler(extension, klass)
@@template_handlers[extension.to_sym] = klass
- TemplateFinder.update_extension_cache_for(extension.to_s)
end
def self.template_handler_extensions
@@ -9,7 +9,6 @@ class TemplateFinder #:nodoc:
}
class << self #:nodoc:
-
# This method is not thread safe. Mutex should be used whenever this is accessed from an instance method
def process_view_paths(*view_paths)
view_paths.flatten.compact.each do |dir|
@@ -26,7 +25,7 @@ def process_view_paths(*view_paths)
# Build extension cache
extension = file.split(".").last
- if template_handler_extensions.include?(extension)
+ if ActionView::Template.template_handler_extensions.include?(extension)
key = file.split(dir).last.sub(/^\//, '').sub(/\.(\w+)$/, '')
@@file_extension_cache[dir][key] << extension
end
@@ -35,19 +34,6 @@ def process_view_paths(*view_paths)
end
end
- def update_extension_cache_for(extension)
- @@processed_view_paths.keys.each do |dir|
- Dir.glob("#{dir}/**/*.#{extension}").each do |file|
- key = file.split(dir).last.sub(/^\//, '').sub(/\.(\w+)$/, '')
- @@file_extension_cache[dir][key] << extension
- end
- end
- end
-
- def template_handler_extensions
- ActionView::Template.template_handler_extensions
- end
-
def reload!
view_paths = @@processed_view_paths.keys
@@ -57,11 +57,4 @@ def test_should_report_file_exists_correctly
assert_equal false, @finder.send(:file_exists?, 'baz')
assert_equal false, @finder.send(:file_exists?, 'baz.rb')
end
-
- uses_mocha 'Template finder tests' do
- def test_should_update_extension_cache_when_template_handler_is_registered
- ActionView::TemplateFinder.expects(:update_extension_cache_for).with("funky")
- ActionView::Template::register_template_handler :funky, Class.new(ActionView::TemplateHandler)
- end
- end
end

0 comments on commit 2336430

Please sign in to comment.