lib/liquid/parse_context.rb in liquid-5.5.1 vs lib/liquid/parse_context.rb in liquid-5.6.0.rc1
- old
+ new
@@ -1,13 +1,14 @@
# frozen_string_literal: true
module Liquid
class ParseContext
attr_accessor :locale, :line_number, :trim_whitespace, :depth
- attr_reader :partial, :warnings, :error_mode
+ attr_reader :partial, :warnings, :error_mode, :environment
- def initialize(options = {})
+ def initialize(options = Const::EMPTY_HASH)
+ @environment = options.fetch(:environment, Environment.default)
@template_options = options ? options.dup : {}
@locale = @template_options[:locale] ||= I18n.new
@warnings = []
@@ -33,10 +34,10 @@
def partial=(value)
@partial = value
@options = value ? partial_options : @template_options
- @error_mode = @options[:error_mode] || Template.error_mode
+ @error_mode = @options[:error_mode] || @environment.error_mode
end
def partial_options
@partial_options ||= begin
dont_pass = @template_options[:include_options_blacklist]