diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-01-22 01:46:34 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-01-22 01:46:34 +0000 |
commit | c0110a9faa1fc414c960a1c639aa8b121d92ca82 (patch) | |
tree | 0e618f0c76ffb3fcb973859977f91d4ee9f7cf6d /actionpack/lib/action_view/template_handlers/builder.rb | |
parent | 91de20d6212b5203587d549ce2d63efcc5996eb0 (diff) | |
download | rails-c0110a9faa1fc414c960a1c639aa8b121d92ca82.tar.gz rails-c0110a9faa1fc414c960a1c639aa8b121d92ca82.tar.bz2 rails-c0110a9faa1fc414c960a1c639aa8b121d92ca82.zip |
Refactor template compilation from AV::Base into the template handlers. Closes #10888 [lifofifo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8689 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/template_handlers/builder.rb')
-rw-r--r-- | actionpack/lib/action_view/template_handlers/builder.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/template_handlers/builder.rb b/actionpack/lib/action_view/template_handlers/builder.rb index 098c90f5c7..cff9e6beb8 100644 --- a/actionpack/lib/action_view/template_handlers/builder.rb +++ b/actionpack/lib/action_view/template_handlers/builder.rb @@ -3,18 +3,16 @@ require 'builder' module ActionView module TemplateHandlers class Builder < TemplateHandler + include Compilable + def self.line_offset 2 end - def self.compilable? - true - end - 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" + + "xml = ::Builder::XmlMarkup.new(:indent => 2)\n" + template + "\nxml.target!\n" end |