diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-19 17:18:07 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-19 17:18:07 -0700 |
commit | c440c9b199d7474e356472616ef03f9c7e17c405 (patch) | |
tree | 8c115c85d38870ad08951fe3d5c0bd6c81a7b71a /actionpack/lib | |
parent | 2e232af91f7e276904e02cbb1ea42ea24c19255b (diff) | |
download | rails-c440c9b199d7474e356472616ef03f9c7e17c405.tar.gz rails-c440c9b199d7474e356472616ef03f9c7e17c405.tar.bz2 rails-c440c9b199d7474e356472616ef03f9c7e17c405.zip |
Move erb_trim_mode setting to the ERB template handler. Keep a Base.erb_trim_mode= delegator around.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_view/template_handlers/erb.rb | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 4f3cc46a14..197455a933 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -161,10 +161,9 @@ module ActionView #:nodoc: attr_accessor :output_buffer - # Specify trim mode for the ERB compiler. Defaults to '-'. - # See ERb documentation for suitable values. - @@erb_trim_mode = '-' - cattr_accessor :erb_trim_mode + class << self + delegate :erb_trim_mode=, :to => 'ActionView::TemplateHandlers::ERB' + end # Specify whether file modification times should be checked to see if a template needs recompilation @@cache_template_loading = false diff --git a/actionpack/lib/action_view/template_handlers/erb.rb b/actionpack/lib/action_view/template_handlers/erb.rb index ad4ccc7c42..0733b3e3c2 100644 --- a/actionpack/lib/action_view/template_handlers/erb.rb +++ b/actionpack/lib/action_view/template_handlers/erb.rb @@ -42,8 +42,13 @@ module ActionView class ERB < TemplateHandler include Compilable + # Specify trim mode for the ERB compiler. Defaults to '-'. + # See ERb documentation for suitable values. + cattr_accessor :erb_trim_mode + self.erb_trim_mode = '-' + def compile(template) - ::ERB.new(template.source, nil, @view.erb_trim_mode, '@output_buffer').src + ::ERB.new(template.source, nil, erb_trim_mode, '@output_buffer').src end def cache_fragment(block, name = {}, options = nil) #:nodoc: |