Class: Tequila::JazzHandler

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

Instance Method Summary collapse

Instance Method Details

#cache_fragment(block, name = {}, options = nil) ⇒ Object



20
21
22
23
24
# File 'lib/tequila_jazz_handler.rb', line 20

def cache_fragment(block, name = {}, options = nil)
  @view.fragment_for(block, name, options) do
    eval("_tequila_out", block.binding)
  end
end

#compile(template) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/tequila_jazz_handler.rb', line 12

def compile(template)
  <<CODE.gsub('\n',';')
    controller.response.content_type = Mime::JSON
    src = ::TequilaPreprocessor.run(template.source)
    _tequila_out =::TequilaParser.new.parse(src).eval(binding).build_hash.to_json
CODE
end