Skip to content

Commit

Permalink
updating documentation for register_template_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
James A. Rosen committed Feb 2, 2012
1 parent 66fc1d6 commit 03ae795
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions actionpack/lib/action_view/template/handlers.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ def self.extensions
@@template_extensions ||= @@template_handlers.keys @@template_extensions ||= @@template_handlers.keys
end 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. # extension. This can be used to implement new template types.
# The constructor for the class must take the ActiveView::Base instance # The handler must respond to `:call`, which will be passed the template
# as a parameter, and the class must implement a +render+ method that # and should return the rendered template as a String.
# takes the contents of the template to render as well as the Hash of def register_template_handler(extension, handler)
# local assigns available to the template. The +render+ method ought to @@template_handlers[extension.to_sym] = handler
# return the rendered template as a string.
def register_template_handler(extension, klass)
@@template_handlers[extension.to_sym] = klass
end end


def template_handler_extensions def template_handler_extensions
Expand Down

0 comments on commit 03ae795

Please sign in to comment.