Sha256: 846d62f1cb1900c758082e7ee7de70e92ff562f65454e833ff3b6e30b6c5538d
Contents?: true
Size: 925 Bytes
Versions: 11
Compression:
Stored size: 925 Bytes
Contents
# frozen_string_literal: true module Liquid class PartialCache def self.load(template_name, context:, parse_context:) cached_partials = context.registers[:cached_partials] cache_key = "#{template_name}:#{parse_context.error_mode}" cached = cached_partials[cache_key] return cached if cached file_system = context.registers[:file_system] source = file_system.read_template_file(template_name) parse_context.partial = true template_factory = context.registers[:template_factory] template = template_factory.for(template_name) begin partial = template.parse(source, parse_context) rescue Liquid::Error => e e.template_name = template&.name || template_name raise e end partial.name ||= template_name cached_partials[cache_key] = partial ensure parse_context.partial = false end end end
Version data entries
11 entries across 11 versions & 1 rubygems