diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-06-12 14:06:59 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-06-12 14:06:59 +0200 |
commit | 8f247871bb18b2e3036a05df5f62cbfe3b402586 (patch) | |
tree | 1e4c8b4b9ccd82f4effe1949b5c116254223e91a /actionview/lib | |
parent | 2a7580e63cdcc9cf1c8837578b1d18602db2b74c (diff) | |
parent | a1dbb4e7e0a580e013423c7adf8ba3127c4c59e0 (diff) | |
download | rails-8f247871bb18b2e3036a05df5f62cbfe3b402586.tar.gz rails-8f247871bb18b2e3036a05df5f62cbfe3b402586.tar.bz2 rails-8f247871bb18b2e3036a05df5f62cbfe3b402586.zip |
Merge pull request #15590 from zuhao/refactor_actionview_register_template_handler
Add unregister_template_handler to prevent leaks.
Conflicts:
actionview/CHANGELOG.md
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/template/handlers.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 |