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.1'

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 =  'self.output_buffer = (' + template.source + ')'
  unless File.basename(template.filename).starts_with?('_')
    src += '.to_json'
  end
  src
end