<commit_before>module Middleman::Sitemap
  class Store
    attr_accessor :app
    
    def initialize(app)
      @app = app
      @cache = ::Middleman::Cache.new
      @source = File.expand_path(@app.source, @app.root)
      @pages = {}
    end
    
    # Check to see if we know about a specific path
    def exists?(path)
      @pages.has_key?(path.sub(/^\//, ""))
    end
    
    def set_context(path, opts={}, blk=nil)
      page(path) do
        template.options = opts
        template.blocks  = [blk]
      end
    end
    
    def ignore(path)
      page(path) { ignore }
      @cache.remove(:ignored_paths)
    end
    
    def proxy(path, target)
      page(path) { proxy_to(target.sub(%r{^/}, "")) }
      @cache.remove(:proxied_paths)
    end
    
    def page(path, &block)
      path = path.sub(/^\//, "").gsub("%20", " ")
      @pages[path] = ::Middleman::Sitemap::Page.new(self, path) unless @pages.has_key?(path)
      @pages[path].instance_exec(&block) if block_given?
      @pages[path]
    end
    
    def all_paths
      @pages.keys
    end
    
    def ignored?(path)
      ignored_paths.include?(path.sub(/^\//, ""))
    end
    
    def ignored_paths
      @cache.fetch :ignored_paths do
        @pages.values.select(&:ignored?).map(&:path)
      end
    end
    
    def generic?(path)
      generic_paths.include?(path.sub(/^\//, ""))
    end
    
    def generic_paths
      @cache.fetch :generic_paths do
        @pages.values.select(&:generic?).map(&:path)
      end
    end
    
    def proxied?(path)
      proxied_paths.include?(path.sub(/^\//, ""))
    end
    
    def proxied_paths<commit_msg>re add sitemap each<commit_after>module Middleman::Sitemap
  class Store
    attr_accessor :app
    
    def initialize(app)
      @app = app
      @cache = ::Middleman::Cache.new
      @source = File.expand_path(@app.source, @app.root)
      @pages = {}
    end
    
    # Check to see if we know about a specific path
    def exists?(path)
      @pages.has_key?(path.sub(/^\//, ""))
    end
    
    def set_context(path, opts={}, blk=nil)
      page(path) do
        template.options = opts
        template.blocks  = [blk]
      end
    end
    
    def ignore(path)
      page(path) { ignore }
      @cache.remove(:ignored_paths)
    end
    
    def proxy(path, target)
      page(path) { proxy_to(target.sub(%r{^/}, "")) }
      @cache.remove(:proxied_paths)
    end
    
    def page(path, &block)
      path = path.sub(/^\//, "").gsub("%20", " ")
      @pages[path] = ::Middleman::Sitemap::Page.new(self, path) unless @pages.has_key?(path)
      @pages[path].instance_exec(&block) if block_given?
      @pages[path]
    end
    
    def each(&block)
      @pages.each do |k, v|
        yield k, v
      end
    end
    
    def all_paths
      @pages.keys
    end
    
    def ignored?(path)
      ignored_paths.include?(path.sub(/^\//, ""))
    end
    
    def ignored_paths
      @cache.fetch :ignored_paths do
        @pages.values.select(&:ignored?).map(&:path)
      end
    end
    
    def generic?(path)
      generic_paths.include?(path.sub(/^\//, ""))
    end
    
    def generic_paths
      @cache.fetch :generic_paths do
        @pages.values.select(&:generic?).map(&:path)
      end
    end
    
    def proxied?(path)
      proxied_paths.include?(path.sub(/^\//, ""))
    end
    
    def proxied_paths
{'fraction_non_alphanumeric': 0.14924039320822163, 'fraction_numerical': 0.0011915400655347036, 'mean_word_length': 2.0610756608933456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2465086', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1164, 'n_words': 225}