<commit_before>module DynamicSitemaps
  class Sitemap
    attr_accessor :name, :collection, :block

    # Initializes a sitemap object.
    # 
    #   Sitemap.new(:site) do
    #     url root_url
    #   end
    # 
    # Using an ActiveRecord relation:
    # 
    #   Sitemap.new(:site, Product.visible) do |product|
    #     url product
    #     url product_editions_path(product)
    #   end
    
    attr_reader :host, :folder

    def initialize(*args, &block)
      if args.first.is_a?(Symbol)
        @name = args.shift
      end

      if args.first.respond_to?(:find_each) || args.first.respond_to?(:each)
        @collection = args.shift
        @name ||= begin
          @collection.table_name if @collection.respond_to?(:table_name)
        end
      end

      if args.last.is_a?(Hash)
        options = args.pop
        @per_page = options[:per_page]
        @host = options[:host]
        @folder = options[:folder]
      end

      @block = block
    end

    def root_url
      "http://#{host}"
    end

    def per_page
      @per_page ||= DynamicSitemaps::DEFAULT_PER_PAGE
    end

    # Generates sitemap XML files based on this sitemap
    def generate
    end
  end
end<commit_msg>Move collection down as hash also responds to #each<commit_after>module DynamicSitemaps
  class Sitemap
    attr_accessor :name, :collection, :block

    # Initializes a sitemap object.
    # 
    #   Sitemap.new(:site) do
    #     url root_url
    #   end
    # 
    # Using an ActiveRecord relation:
    # 
    #   Sitemap.new(:site, Product.visible) do |product|
    #     url product
    #     url product_editions_path(product)
    #   end
    
    attr_reader :host, :folder

    def initialize(*args, &block)
      if args.first.is_a?(Symbol)
        @name = args.shift
      end

      if args.last.is_a?(Hash)
        options = args.pop
        @per_page = options[:per_page]
        @host = options[:host]
        @folder = options[:folder]
      end

      if args.first.respond_to?(:find_each) || args.first.respond_to?(:each)
        @collection = args.shift
        @name ||= begin
          @collection.table_name if @collection.respond_to?(:table_name)
        end
      end

      @block = block
    end

    def root_url
      "http://#{host}"
    end

    def per_page
      @per_page ||= DynamicSitemaps::DEFAULT_PER_PAGE
    end

    # Generates sitemap XML files based on this sitemap
    def generate
    end
  end
end
{'fraction_non_alphanumeric': 0.09852820932134096, 'fraction_numerical': 0.0, 'mean_word_length': 2.1013941698352343, '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': '3286888', 'n_tokens_mistral': 805, 'n_tokens_neox': 783, 'n_words': 185}