Class: LiquidRenderer::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid_renderer/renderer.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ Renderer

Returns a new instance of Renderer.



6
7
8
# File 'lib/liquid_renderer/renderer.rb', line 6

def initialize(view)
  @view = view
end

Class Method Details

.call(template) ⇒ Object



10
11
12
# File 'lib/liquid_renderer/renderer.rb', line 10

def self.call(template)
  "LiquidRenderer::Renderer.new(self).render(#{template.source.inspect}, local_assigns)"
end

Instance Method Details

#compilable?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/liquid_renderer/renderer.rb', line 21

def compilable?
  false
end

#render(template, local_assigns = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/liquid_renderer/renderer.rb', line 14

def render(template, local_assigns = {})
  _set_default_content_type
  assigns = _merge_assigns(local_assigns)
  liquid = Liquid::Template.parse(template)
  liquid.render(assigns, filters: _filters, registers: _registers)
end