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 8 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 18 def [](option_key) @options[option_key] end
new_block_body()
click to toggle source
# File lib/liquid/parse_context.rb, line 22 def new_block_body Liquid::BlockBody.new end
new_tokenizer(markup, start_line_number: nil, for_liquid_tag: false)
click to toggle source
# File lib/liquid/parse_context.rb, line 26 def new_tokenizer(markup, start_line_number: nil, for_liquid_tag: false) Tokenizer.new(markup, line_number: start_line_number, for_liquid_tag: for_liquid_tag) end
parse_expression(markup)
click to toggle source
# File lib/liquid/parse_context.rb, line 30 def parse_expression(markup) Expression.parse(markup) end
partial=(value)
click to toggle source
# File lib/liquid/parse_context.rb, line 34 def partial=(value) @partial = value @options = value ? partial_options : @template_options @error_mode = @options[:error_mode] || Template.error_mode end
partial_options()
click to toggle source
# File lib/liquid/parse_context.rb, line 41 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