class Verto::Template

Public Class Methods

new(template_name) click to toggle source
# File lib/verto/utils/template.rb, line 9
def initialize(template_name)
  @template_name = template_name
end
render(template_name, to:) click to toggle source
# File lib/verto/utils/template.rb, line 5
def self.render(template_name, to:)
  new(template_name).render(to: to)
end

Public Instance Methods

render(to:) click to toggle source
# File lib/verto/utils/template.rb, line 13
def render(to:)
  path = Pathname.new(to)
  path.join(@template_name).write(template_content)
end

Private Instance Methods

template_content() click to toggle source
# File lib/verto/utils/template.rb, line 20
def template_content
  @template_content = template_path.join(@template_name).read
end
template_path() click to toggle source
# File lib/verto/utils/template.rb, line 24
def template_path
  Verto.root_path.join('lib/verto/utils/templates')
end