Class: EJSHandler

Inherits:
ActionView::TemplateHandler
  • Object
show all
Defined in:
lib/rails/init.rb

Defined Under Namespace

Classes: EJSProxy

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ EJSHandler



22
23
24
# File 'lib/rails/init.rb', line 22

def initialize(view)
  @view = view
end

Instance Method Details

#render(template) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/rails/init.rb', line 26

def render(template)
  ctx = Johnson::Runtime.new
  ctx.evaluate('Johnson.require("johnson/template");')
  ctx['template'] = template.source
  ctx['controller'] = @view.controller
  ctx['at'] = EJSProxy.new(@view.controller)

  ctx.evaluate('Johnson.templatize(template).call(at)')
end