Sha256: 7b23d3d12fcfc39df82d05b33e059adadb98654371be26f6f91b445cd471c145
Contents?: true
Size: 632 Bytes
Versions: 10
Compression:
Stored size: 632 Bytes
Contents
require 'liquid' module Epubber::Services class Template # Compiles and renderes a template file in the given context def parse(file:, context:) compile(file).render context end # Compiles a file and returns a template instance ready to be rendered def compile(file) Liquid::Template.parse load(file) end # Returns the full path for a given template file def path(file) File.join File.dirname(__FILE__), '../../templates/', file end protected # Opens a file from disk located inside ./templates def load(file) File.open(path(file)).read end end end
Version data entries
10 entries across 10 versions & 1 rubygems