From a1dbb4e7e0a580e013423c7adf8ba3127c4c59e0 Mon Sep 17 00:00:00 2001 From: Zuhao Wan Date: Mon, 9 Jun 2014 22:45:46 +0800 Subject: Add unregister_template_handler to prevent leaks. --- actionview/lib/action_view/template/handlers.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/template/handlers.rb b/actionview/lib/action_view/template/handlers.rb index d9cddc0040..33bfcb458c 100644 --- a/actionview/lib/action_view/template/handlers.rb +++ b/actionview/lib/action_view/template/handlers.rb @@ -32,6 +32,15 @@ module ActionView #:nodoc: @@template_extensions = nil end + # Opposite to register_template_handler. + def unregister_template_handler(*extensions) + extensions.each do |extension| + handler = @@template_handlers.delete extension.to_sym + @@default_template_handlers = nil if @@default_template_handlers == handler + end + @@template_extensions = nil + end + def template_handler_extensions @@template_handlers.keys.map {|key| key.to_s }.sort end -- cgit v1.2.3