Method: Liquid::ParseContext#initialize
- Defined in:
- lib/liquid/parse_context.rb
#initialize(options = Const::EMPTY_HASH) ⇒ ParseContext
Returns a new instance of ParseContext.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/liquid/parse_context.rb', line 8 def initialize( = Const::EMPTY_HASH) @environment = .fetch(:environment, Environment.default) @template_options = ? .dup : {} @locale = @template_options[:locale] ||= I18n.new @warnings = [] # constructing new StringScanner in Lexer, Tokenizer, etc is expensive # This StringScanner will be shared by all of them @string_scanner = StringScanner.new("") @expression_cache = if [:expression_cache].nil? {} elsif [:expression_cache].respond_to?(:[]) && [:expression_cache].respond_to?(:[]=) [:expression_cache] elsif [:expression_cache] {} end self.depth = 0 self.partial = false end |