Class: Trixie::Template
- Inherits:
-
Object
- Object
- Trixie::Template
- Defined in:
- lib/trixie/template.rb
Overview
Render templates in lib/templates folder to a custom path
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(template_name) ⇒ Template
constructor
A new instance of Template.
- #render(to:) ⇒ Object
Constructor Details
#initialize(template_name) ⇒ Template
Returns a new instance of Template.
10 11 12 |
# File 'lib/trixie/template.rb', line 10 def initialize(template_name) @template_name = template_name end |
Class Method Details
.render(template_name, to:) ⇒ Object
6 7 8 |
# File 'lib/trixie/template.rb', line 6 def self.render(template_name, to:) new(template_name).render(to: to) end |
Instance Method Details
#render(to:) ⇒ Object
14 15 16 17 |
# File 'lib/trixie/template.rb', line 14 def render(to:) path = Pathname.new(to) path.write(template_content) end |