Permalink
Browse files

Move erb_trim_mode setting to the ERB template handler. Keep a Base.e…

…rb_trim_mode= delegator around.
  • Loading branch information...
1 parent 2e232af commit c440c9b199d7474e356472616ef03f9c7e17c405 @jeremy jeremy committed Jun 20, 2008
Showing with 9 additions and 5 deletions.
  1. +3 −4 actionpack/lib/action_view/base.rb
  2. +6 −1 actionpack/lib/action_view/template_handlers/erb.rb
@@ -161,10 +161,9 @@ class Base
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
@@ -42,8 +42,13 @@ module TemplateHandlers
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:

0 comments on commit c440c9b

Please sign in to comment.