Class: Jsonr::TemplateHandler

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

Instance Method Summary collapse

Instance Method Details

#compile(template) ⇒ Object



7
8
9
10
11
# File 'lib/jsonr/template_handler.rb', line 7

def compile(template)
  "@template_format = :html;" +
  "controller.response.content_type ||= Mime::JSON;" +
  "Jsonr::Generator.new{ |page| #{template.source} }.to_s"
end