<commit_before>$:.unshift(__dir__)

require 'rubygems'
require 'fileutils'
require 'interview'
require 'link'
require 'ware'

module UsesThis
  class Site
    
    attr_accessor :paths, :interviews, :archives, :wares, :pages, :links, :templates, :categories

    def self.instance
      @site ||= new
    end

    def scan
      @templates = {}

      Dir.glob(File.join(@paths[:source], 'templates', '*.erb')).each do |path|
        template = Template.new(path)
        @templates[template.slug] = template
      end

      @pages = []

      Dir.glob(File.join(@paths[:source], 'pages', '**', '*.*')).each do |path|
        page = Page.new(path)
        @pages.push(page)
      end

      @wares = {}

      Dir.glob(File.join(@paths[:data], 'wares', '**', '*.yml')).each do |path|
        ware = Ware.new(path)
        @wares[ware.slug] = ware
      end

      @links = {
        personal: [],
        inspired: [],
      }

      Dir.glob(File.join(@paths[:data], 'links', '**', '*.yml')).each do |path|
        link = Link.new(path)

        if File.dirname(path) =~ /personal/
          @links[:personal].push(link)
        else
          @links[:inspired].push(link)
        end
      end

      @interviews = []

      Dir.glob(File.join(@paths[:source], 'interviews', '*.*')).each do |path|
        interview = Interview.new(path)
        @interviews.push(interview)
      end

      @interviews.reverse!

      @categories = {}
      @archives = {}
      
      interviews.each do |interview|<commit_msg>Simplify scanning.<commit_after>$:.unshift(__dir__)

require 'rubygems'
require 'fileutils'
require 'interview'
require 'link'
require 'ware'

module UsesThis
  class Site
    
    attr_accessor :paths, :interviews, :archives, :wares, :pages, :links, :templates, :categories

    def self.instance
      @site ||= new
    end

    def scan
      @templates = {}

      Dir.glob(File.join(@paths[:source], 'templates', '*.erb')).each do |path|
        template = Template.new(path)
        @templates[template.slug] = template
      end

      @pages = []

      Dir.glob(File.join(@paths[:source], 'pages', '**', '*.*')).each do |path|
        @pages.push(Page.new(path))
      end

      @wares = {}

      Dir.glob(File.join(@paths[:data], 'wares', '**', '*.yml')).each do |path|
        ware = Ware.new(path)
        @wares[ware.slug] = ware
      end

      @links = {
        personal: [],
        inspired: [],
      }

      Dir.glob(File.join(@paths[:data], 'links', '**', '*.yml')).each do |path|
        link = Link.new(path)

        if File.dirname(path) =~ /personal/
          @links[:personal].push(link)
        else
          @links[:inspired].push(link)
        end
      end

      @interviews = []

      Dir.glob(File.join(@paths[:source], 'interviews', '*.*')).each do |path|
        @interviews.push(Interview.new(path))
      end

      @interviews.reverse!

      @categories = {}
      @archives = {}
      
      @interviews.each do |interview|
{'fraction_non_alphanumeric': 0.17481580709979908, 'fraction_numerical': 0.0, 'mean_word_length': 2.26448087431694, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2444547', 'n_tokens_mistral': 992, 'n_tokens_neox': 960, 'n_words': 190}