Module: Antex::LiquidHelpers
- Included in:
- Job
- Defined in:
- lib/antex/liquid_helpers.rb
Overview
Exposes helper methods to simplify Liquid templates rendering.
Defined Under Namespace
Classes: UnknownClass
Instance Method Summary collapse
-
#liquid_render(object, context_hash = {}) ⇒ String
Recursively renders
Liquidtemplate strings, possibly organized in nested arrays and hashes, using the given hash of contextual variables.
Instance Method Details
#liquid_render(object, context_hash = {}) ⇒ String
Recursively renders Liquid template strings, possibly organized in nested arrays and hashes, using the given hash of contextual variables.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/antex/liquid_helpers.rb', line 18 def liquid_render(object, context_hash = {}) case object when String liquid_render_string object, context_hash when Array liquid_render_array object, context_hash when Hash liquid_render_hash object, context_hash else raise UnknownClass, "I don't know how to render a #{object.class}." end end |