lib/simple/liquid.rb in simple-liquid-1.0.0 vs lib/simple/liquid.rb in simple-liquid-1.1.0
- old
+ new
@@ -5,31 +5,33 @@
class Simple::Liquid
class Error < RuntimeError
end
- VERSION = '1.0.0'
+ VERSION = '1.1.0'
- attr_reader :template, :object
+ attr_reader :template, :object, :filters
- def initialize(template, object = {})
+ def initialize(template, object = {}, filters = [])
@template = template
@object = deep_stringify_keys(object.to_h)
+ @filters = filters
end
- def self.render(template, object = {})
- new(template, object).render
+ def self.render(template, object = {}, filters = [])
+ new(template, object, filters).render
end
def liquid_template
@liquid_template ||= ::Liquid::Template.parse(template, error_mode: :strict)
end
def render
liquid_template.render(
object,
strict_variables: true,
- strict_filters: true
+ strict_filters: true,
+ filters: filters
).tap { raise_if_errors! }
end
def raise_if_errors!
errors = liquid_template.errors