Class: RubyTemplateHandler

Inherits:
ActionView::TemplateHandler
  • Object
show all
Includes:
ActionView::TemplateHandlers::Compilable
Defined in:
lib/ruby_template_handler.rb

Constant Summary collapse

VERSION =
'0.0.2'

Instance Method Summary collapse

Instance Method Details

#compile(template) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/ruby_template_handler.rb', line 8

def compile(template)
  src = template.source
  unless File.basename(template.filename).starts_with?('_')
    src = 'ActiveSupport::JSON.encode(' + src + ')'
  end
  'self.output_buffer = (' + src + ')'
end