Class: Verto::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/verto/utils/template.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_name) ⇒ Template

Returns a new instance of Template.



9
10
11
# File 'lib/verto/utils/template.rb', line 9

def initialize(template_name)
  @template_name = template_name
end

Class Method Details

.render(template_name, to:) ⇒ Object



5
6
7
# File 'lib/verto/utils/template.rb', line 5

def self.render(template_name, to:)
  new(template_name).render(to: to)
end

Instance Method Details

#render(to:) ⇒ Object



13
14
15
16
# File 'lib/verto/utils/template.rb', line 13

def render(to:)
  path = Pathname.new(to)
  path.join(@template_name).write(template_content)
end