aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-17 07:20:14 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-17 07:20:14 -0700
commitd9f936e61b15ae163e92ca92822b242baeec986d (patch)
treed78a704e9f10263b71bb008cf22ce9fe941bd613 /actionpack/lib/action_view
parentc35a7d78ec2599b597296dc6749ca3d7ac434177 (diff)
parent13b0af736e6bd1242827409f59d528673b97fcc9 (diff)
downloadrails-d9f936e61b15ae163e92ca92822b242baeec986d.tar.gz
rails-d9f936e61b15ae163e92ca92822b242baeec986d.tar.bz2
rails-d9f936e61b15ae163e92ca92822b242baeec986d.zip
Merge pull request #7644 from insside/register_template_handler-method-refactoring
Allowing pass couple extension to one register_template_handler call
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/template/handlers.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/template/handlers.rb b/actionpack/lib/action_view/template/handlers.rb
index 52e032bbd8..47e572967a 100644
--- a/actionpack/lib/action_view/template/handlers.rb
+++ b/actionpack/lib/action_view/template/handlers.rb
@@ -21,11 +21,14 @@ module ActionView #:nodoc:
end
# Register an object that knows how to handle template files with the given
- # extension. This can be used to implement new template types.
+ # extensions. This can be used to implement new template types.
# The handler must respond to `:call`, which will be passed the template
# and should return the rendered template as a String.
- def register_template_handler(extension, handler)
- @@template_handlers[extension.to_sym] = handler
+ def register_template_handler(*extensions, handler)
+ raise(ArgumentError, "Extension is required") if extensions.empty?
+ extensions.each do |extension|
+ @@template_handlers[extension.to_sym] = handler
+ end
@@template_extensions = nil
end