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

LowLoad hook.



47
48
49
# File 'lib/templates/renderer.rb', line 47

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

#renderObject

Accepts all arguments but only sends arguments required by the sub class.



31
32
33
34
35
36
37
38
39
# File 'lib/templates/renderer.rb', line 31

def render(**)
  # GOAL: Make return value configurable; ResponseEvent, Response, or body.
  body = response_body(**)

  return if body.nil? || body == ''

  response = Low::Factories::ResponseFactory.html(body:)
  Low::Events::ResponseEvent.new(response:).tap(&:branch)
end

#templateObject

LowLoad hook.



42
43
44
# File 'lib/templates/renderer.rb', line 42

def template
  @template
end