Skip to content

Instantly share code, notes, and snippets.

@yevgenko
Created January 19, 2016 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yevgenko/bdda54a505c4ce18309c to your computer and use it in GitHub Desktop.
Save yevgenko/bdda54a505c4ce18309c to your computer and use it in GitHub Desktop.
Sample class shows one way to wrap Liquid library
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