aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-02-01 20:38:16 -0800
committerJosé Valim <jose.valim@plataformatec.com.br>2012-02-01 20:38:16 -0800
commit76665025fb0fcda2281a7df50cc82eaa56065a8f (patch)
tree69b0654d131aa976f37c7c05f3ad12afb08dd29a
parent00e192ef1f613339b2f0fadd537b5e3c9e9f8cbf (diff)
parent03ae795593aef21dc39e96f15305421caea28772 (diff)
downloadrails-76665025fb0fcda2281a7df50cc82eaa56065a8f.tar.gz
rails-76665025fb0fcda2281a7df50cc82eaa56065a8f.tar.bz2
rails-76665025fb0fcda2281a7df50cc82eaa56065a8f.zip
Merge pull request #4842 from jamesarosen/master
Update documentation for register_template_handler
-rw-r--r--actionpack/lib/action_view/template/handlers.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/template/handlers.rb b/actionpack/lib/action_view/template/handlers.rb
index aa693335e3..67978ada7e 100644
--- a/actionpack/lib/action_view/template/handlers.rb
+++ b/actionpack/lib/action_view/template/handlers.rb
@@ -17,15 +17,12 @@ module ActionView #:nodoc:
@@template_extensions ||= @@template_handlers.keys
end
- # Register a class that knows how to handle template files with the given
+ # Register an object that knows how to handle template files with the given
# extension. This can be used to implement new template types.
- # The constructor for the class must take the ActiveView::Base instance
- # as a parameter, and the class must implement a +render+ method that
- # takes the contents of the template to render as well as the Hash of
- # local assigns available to the template. The +render+ method ought to
- # return the rendered template as a string.
- def register_template_handler(extension, klass)
- @@template_handlers[extension.to_sym] = klass
+ # 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
end
def template_handler_extensions