Class: ActionView::TemplateHandlers::Erubis

Inherits:
TemplateHandler
  • Object
show all
Includes:
Compilable, Erubis::Helpers::RailsHelper::TemplateConverter, Erubis::PreprocessingHelper
Defined in:
lib/erubis_rails_helper/template_handlers/erubis.rb

Instance Method Summary collapse

Methods included from Erubis::Helpers::RailsHelper::TemplateConverter

#_convert_template, #_create_preprocessor, #_preprocessing_context_object, #preprocess?

Instance Method Details

#compile(template) ⇒ Object



233
234
235
236
237
238
239
240
241
242
243
# File 'lib/erubis_rails_helper/template_handlers/erubis.rb', line 233

def compile(template)
  src =  _convert_template("<% __in_erb_template=true %>#{template.source}") 
  
  if show_source?
    logger.debug("** Erubis: src==<<'END'\n#{src}END\n") if logger
  end
  
  # Ruby 1.9 prepends an encoding to the source. However this is
  # useless because you can only set an encoding on the first line
  RUBY_VERSION >= '1.9' ? src.sub(/\A#coding:.*\n/, '') : src        
end