From 8ee60660cec54f008ddaa54a4e8e06d099d8c7f5 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 25 Jun 2009 14:23:03 -0700 Subject: Try speeding up rails booting --- actionpack/lib/action_view/template/handlers/builder.rb | 3 +-- actionpack/lib/action_view/template/handlers/erb.rb | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_view/template') diff --git a/actionpack/lib/action_view/template/handlers/builder.rb b/actionpack/lib/action_view/template/handlers/builder.rb index abe140af0b..5f381f7bf0 100644 --- a/actionpack/lib/action_view/template/handlers/builder.rb +++ b/actionpack/lib/action_view/template/handlers/builder.rb @@ -1,5 +1,3 @@ -require 'builder' - module ActionView module TemplateHandlers class Builder < TemplateHandler @@ -8,6 +6,7 @@ module ActionView self.default_format = Mime::XML def compile(template) + require 'builder' "xml = ::Builder::XmlMarkup.new(:indent => 2);" + "self.output_buffer = xml.target!;" + template.source + diff --git a/actionpack/lib/action_view/template/handlers/erb.rb b/actionpack/lib/action_view/template/handlers/erb.rb index 21272ef089..e3a7d96941 100644 --- a/actionpack/lib/action_view/template/handlers/erb.rb +++ b/actionpack/lib/action_view/template/handlers/erb.rb @@ -1,4 +1,3 @@ -require 'erb' require 'active_support/core_ext/class/attribute_accessors' module ActionView @@ -16,6 +15,8 @@ module ActionView self.default_format = Mime::HTML def compile(template) + require 'erb' + magic = $1 if template.source =~ /\A(<%#.*coding:\s*(\S+)\s*-?%>)/ erb = "#{magic}<% __in_erb_template=true %>#{template.source}" ::ERB.new(erb, nil, erb_trim_mode, '@output_buffer').src -- cgit v1.2.3