class Liquid::ParseContext

Attributes

depth[RW]
error_mode[R]
line_number[RW]
locale[RW]
partial[R]
trim_whitespace[RW]
warnings[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/liquid/parse_context.rb, line 6
def initialize(options = {})
  @template_options = options ? options.dup : {}
  @locale = @template_options[:locale] ||= I18n.new
  @warnings = []
  self.depth = 0
  self.partial = false
end

Public Instance Methods

[](option_key) click to toggle source
# File lib/liquid/parse_context.rb, line 14
def [](option_key)
  @options[option_key]
end
partial=(value) click to toggle source
# File lib/liquid/parse_context.rb, line 18
def partial=(value)
  @partial = value
  @options = value ? partial_options : @template_options
  @error_mode = @options[:error_mode] || Template.error_mode
  value
end
partial_options() click to toggle source
# File lib/liquid/parse_context.rb, line 25
def partial_options
  @partial_options ||= begin
    dont_pass = @template_options[:include_options_blacklist]
    if dont_pass == true
      { locale: locale }
    elsif dont_pass.is_a?(Array)
      @template_options.reject { |k, v| dont_pass.include?(k) }
    else
      @template_options
    end
  end
end