Class: Amrita2View::Base
Constant Summary collapse
- @@compiled_amrita2_templates =
{}
Instance Method Summary collapse
-
#initialize(action_view) ⇒ Base
constructor
A new instance of Base.
- #render(template, local_assigns = {}) ⇒ Object
Constructor Details
Instance Method Details
#render(template, local_assigns = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/amrita2/rails_bridge.rb', line 12 def render( template, local_assigns={} ) action_name = @action_view.controller.action_name tmpl_method = action_name + "_setup_template" tmpl = @@compiled_amrita2_templates[template] ||= if @action_view.respond_to?(tmpl_method) @action_view.send(tmpl_method, template) else t = Amrita2::TemplateText.new(template) b = @action_view.instance_eval { binding } t.use_erb(b) t end po_method = action_name + "_po" po = nil if @action_view.respond_to?(po_method) po = @action_view.send(po_method) else po = @action_view.controller end tmpl.(out="", po) out rescue $!.to_s + $@.join("<br>") end |