Class: PlasmaView
Instance Method Summary collapse
-
#initialize(action_view) ⇒ PlasmaView
constructor
A new instance of PlasmaView.
- #render(template, local_assigns) ⇒ Object
Constructor Details
#initialize(action_view) ⇒ PlasmaView
Returns a new instance of PlasmaView.
2 3 4 |
# File 'lib/extras/plasma_view.rb', line 2 def initialize(action_view) @action_view = action_view end |
Instance Method Details
#render(template, local_assigns) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/extras/plasma_view.rb', line 6 def render(template, local_assigns) @action_view.controller.headers["Content-Type"] ||= 'text/html; charset=utf-8' assigns = @action_view.assigns.dup if content_for_layout = @action_view.instance_variable_get("@content_for_layout") assigns['content_for_layout'] = content_for_layout end assigns.merge!(local_assigns) plasma = Plasma::Interpreter::PlasmaGrammarParser.new env = Plasma::Interpreter::Env.new(assigns) tree = plasma.parse(template) tree.evaluate(env) end |