aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/handlers.rb
diff options
context:
space:
mode:
authorJames A. Rosen <james@zendesk.com>2012-02-01 16:49:21 -0800
committerJames A. Rosen <james@zendesk.com>2012-02-01 16:49:21 -0800
commit03ae795593aef21dc39e96f15305421caea28772 (patch)
tree15e89e140476d70528261587ff4a5827ba0a4b00 /actionpack/lib/action_view/template/handlers.rb
parent66fc1d6ac8f0f7b797ae18fdcb15cd618e4251f1 (diff)
downloadrails-03ae795593aef21dc39e96f15305421caea28772.tar.gz
rails-03ae795593aef21dc39e96f15305421caea28772.tar.bz2
rails-03ae795593aef21dc39e96f15305421caea28772.zip
updating documentation for register_template_handler
Diffstat (limited to 'actionpack/lib/action_view/template/handlers.rb')
-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