Module: Low::Templates::Renderer::ClassMethods

Defined in:
lib/templates/renderer.rb

Instance Method Summary collapse

Instance Method Details

#build_template(template:, params:, engine:, namespace:) ⇒ Object



38
39
40
# File 'lib/templates/renderer.rb', line 38

def build_template(template:, params:, engine:, namespace:)
  @template = Template.new(template:, params:, engine:, namespace:)
end

#render(event: nil) ⇒ Object

TODO: Handle situation where node is tested in a unit test and args come in here; expose them to the template.



43
44
45
46
47
48
49
# File 'lib/templates/renderer.rb', line 43

def render(event: nil)
  node = self.new(event:)

  # GOAL: Make return value configurable; ResponseEvent, Response, or body.
  response = Low::Factories::ResponseFactory.html(body: body(node:, event:))
  Low::Events::ResponseEvent.new(response:)
end

#render_template(event:) ⇒ Object



51
52
53
# File 'lib/templates/renderer.rb', line 51

def render_template(event:)
  self.new(event:).render_template(event:)
end

#templateObject



34
35
36
# File 'lib/templates/renderer.rb', line 34

def template
  @template
end