diff options
Diffstat (limited to 'actionpack/lib/action_view/template_handlers/builder.rb')
-rw-r--r-- | actionpack/lib/action_view/template_handlers/builder.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template_handlers/builder.rb b/actionpack/lib/action_view/template_handlers/builder.rb new file mode 100644 index 0000000000..a9fc069f88 --- /dev/null +++ b/actionpack/lib/action_view/template_handlers/builder.rb @@ -0,0 +1,15 @@ +require 'builder' + +module ActionView + module TemplateHandlers + class Builder < TemplateHandler + def compile(template) + content_type_handler = (@view.send!(:controller).respond_to?(:response) ? "controller.response" : "controller") + "#{content_type_handler}.content_type ||= Mime::XML\n" + + "xml = Builder::XmlMarkup.new(:indent => 2)\n" + + template + + "\nxml.target!\n" + end + end + end +end |