Created
January 19, 2016 20:05
-
-
Save yevgenko/bdda54a505c4ce18309c to your computer and use it in GitHub Desktop.
Sample class shows one way to wrap Liquid library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TemplateRenderer | |
attr_reader :parsed_template | |
def initialize(template) | |
@parsed_template = template.respond_to?(:parase) ? template : _parse_template(template) | |
end | |
def render(params) | |
_render_template params | |
end | |
def _render_template(params) | |
parsed_template.render params | |
end | |
def _parse_template(template) | |
Liquid::Template.parse template | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment