Sha256: acd67447a2deb11dbf3b09b27540cca855771ec72e9ae9e7562202914f33c5c3

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

require "massive_sitemap/builder/base"

module MassiveSitemap
  module Builder
    class Rotating < Base
      NUM_URLS = 1..50_000

      OPTS = Base::OPTS.merge(
        :max_urls => NUM_URLS.max
      )

      def initialize(writer, options = {}, &block)
        @urls      = 0

        super
      end

      def add_url!(location, attrs = {})
        if @urls >= @options[:max_urls]
          close!
          @urls = 0
        end
        super
        @urls += 1
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
massive_sitemap-2.0.0.rc6 lib/massive_sitemap/builder/rotating.rb
massive_sitemap-2.0.0.rc5 lib/massive_sitemap/builder/rotating.rb