Class: Dugway::Liquifier
- Inherits:
-
Object
- Object
- Dugway::Liquifier
- Defined in:
- lib/dugway/liquifier.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(request) ⇒ Liquifier
constructor
A new instance of Liquifier.
- #render(content, variables = {}) ⇒ Object
Constructor Details
#initialize(request) ⇒ Liquifier
Returns a new instance of Liquifier.
17 18 19 |
# File 'lib/dugway/liquifier.rb', line 17 def initialize(request) @request = request end |
Class Method Details
Instance Method Details
#render(content, variables = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dugway/liquifier.rb', line 21 def render(content, variables={}) variables.symbolize_keys! assigns = shared_assigns assigns['page_content'] = variables[:page_content] assigns['page'] = Drops::PageDrop.new(variables[:page]) assigns['product'] = Drops::ProductDrop.new(variables[:product]) registers = shared_registers registers[:category] = variables[:category] registers[:artist] = variables[:artist] registers[:account] = Dugway.store if errors = variables.delete(:errors) shared_context['errors'] << errors end context = Liquid::Context.new([ assigns, shared_context ], {}, registers) Liquid::Template.parse(content).render!(context) end |