Class: EJSHandler
- Inherits:
-
ActionView::TemplateHandler
- Object
- ActionView::TemplateHandler
- EJSHandler
- Defined in:
- lib/rails/init.rb
Defined Under Namespace
Classes: EJSProxy
Instance Method Summary collapse
-
#initialize(view) ⇒ EJSHandler
constructor
A new instance of EJSHandler.
- #render(template) ⇒ Object
Constructor Details
#initialize(view) ⇒ EJSHandler
Returns a new instance of 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 |