Sha256: 8b9e9843bcdb292fa94d6cc62fb5934eac6adaa1a625d0efd15f2c32c883c3c2
Contents?: true
Size: 833 Bytes
Versions: 6
Compression:
Stored size: 833 Bytes
Contents
# frozen_string_literal: true require 'active_support/dependencies/autoload' module Bemer class TemplateCatalog extend ActiveSupport::Autoload eager_autoload do autoload :Drawer end attr_reader :owner def initialize(owner) @drawers = {} @owner = owner @template_queue = [] end def compiled_templates template_queue = @template_queue @template_queue = [] template_queue.flat_map { |id| drawers[id].compiled_templates } end def add(path, cached = false, &block) return unless block_given? id = [block.source_location, path].join(':') @template_queue << id drawers[id] = Drawer.new(cached, &block) unless drawers.key?(id) && drawers[id].cached? end protected attr_reader :drawers end end
Version data entries
6 entries across 6 versions & 1 rubygems