Class: Epubber::Services::Template
- Inherits:
-
Object
- Object
- Epubber::Services::Template
- Defined in:
- lib/epubber/services/template.rb
Instance Method Summary collapse
-
#compile(file) ⇒ Object
Compiles a file and returns a template instance ready to be rendered.
-
#parse(file:, context:) ⇒ Object
Compiles and renderes a template file in the given context.
-
#path(file) ⇒ Object
Returns the full path for a given template file.
Instance Method Details
#compile(file) ⇒ Object
Compiles a file and returns a template instance ready to be rendered
11 12 13 |
# File 'lib/epubber/services/template.rb', line 11 def compile(file) Liquid::Template.parse load(file) end |
#parse(file:, context:) ⇒ Object
Compiles and renderes a template file in the given context
6 7 8 |
# File 'lib/epubber/services/template.rb', line 6 def parse(file:, context:) compile(file).render context end |
#path(file) ⇒ Object
Returns the full path for a given template file
16 17 18 |
# File 'lib/epubber/services/template.rb', line 16 def path(file) File.join File.dirname(__FILE__), '../../templates/', file end |