Class: Liquid::Renderer
- Inherits:
-
Object
- Object
- Liquid::Renderer
- Defined in:
- app/lib/liquid/renderer.rb
Overview
Library code: renderer.
Class Method Summary collapse
-
.render(template_instance, options = nil, context = nil) ⇒ String
Renders a Liquid template with non-strict variables and filters, logging and reporting any template errors (reporting is skipped when
ignore_errorsis set).
Class Method Details
.render(template_instance, options = nil, context = nil) ⇒ String
Renders a Liquid template with non-strict variables and filters, logging and
reporting any template errors (reporting is skipped when ignore_errors is set).
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/lib/liquid/renderer.rb', line 16 def self.render(template_instance, = nil, context = nil) ||= {} .stringify_keys! res = template_instance.render , { strict_variables: false, strict_filters: false } if template_instance.errors.present? = .dup.transform_values { |v| v.to_s.truncate(20) } = "#{context || 'Unknown context'}: #{template_instance.errors.join(', ')}. Options: #{.inspect}" ErrorReporting.warning if Rails.env.production? && !['ignore_errors'].to_b Rails.logger.warn end res end |