Class: Renderer::Template

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

Defined Under Namespace

Classes: Bind

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Template

Returns a new instance of Template.



26
27
28
29
# File 'lib/renderer/template.rb', line 26

def initialize(path)
  @template = ERB.new(File.read(path))
  @template.filename = path.to_s
end

Instance Method Details

#render(bin) ⇒ Object



31
32
33
34
# File 'lib/renderer/template.rb', line 31

def render(bin, *, **)
  bind = Bind.new(bin, *, **)
  @template.result(bind.make_binding)
end