module ActionView::Template::Handlers
def self.extended(base)
def self.extended(base) base.register_default_template_handler :erb, ERB base.register_template_handler :rjs, RJS base.register_template_handler :builder, Builder # TODO: Depreciate old template extensions base.register_template_handler :rhtml, ERB base.register_template_handler :rxml, Builder end
def self.extensions
def self.extensions @@template_extensions ||= @@template_handlers.keys end
def handler_class_for_extension(extension)
def handler_class_for_extension(extension) (extension && registered_template_handler(extension.to_sym)) || @@default_template_handlers end
def register_default_template_handler(extension, klass)
def register_default_template_handler(extension, klass) register_template_handler(extension, klass) @@default_template_handlers = klass end
def register_template_handler(extension, klass)
local assigns available to the template. The +render+ method ought to
takes the contents of the template to render as well as the Hash of
as a parameter, and the class must implement a +render+ method that
The constructor for the class must take the ActiveView::Base instance
extension. This can be used to implement new template types.
Register a class that knows how to handle template files with the given
def register_template_handler(extension, klass) @@template_handlers[extension.to_sym] = klass end
def registered_template_handler(extension)
def registered_template_handler(extension) extension && @@template_handlers[extension.to_sym] end
def template_handler_extensions
def template_handler_extensions @@template_handlers.keys.map {|key| key.to_s }.sort end