Sha256: 396fb743674145e7c0e071494ace024ea6c0cf88cb4951c98f1a4bd85a813447

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

require "massive_sitemap/builder/base"

module MassiveSitemap
  module Builder
    class Index < Base
      HEADER_NAME       = 'sitemapindex'
      HEADER_ATTRIBUTES = {
        :xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9'
      }

      def initialize(writer, options = {}, &block)
        super(writer, options) do
          writer.each do |path, last_modified|
            add path, :last_modified => last_modified
          end
        end
      end

      def add_url!(location, attrs = {})
        init!

        tag! 'sitemap' do
          tag! 'loc', location
          tag! 'lastmod', attrs[:last_modified].utc.strftime('%Y-%m-%dT%H:%M:%S+00:00') if attrs[:last_modified]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
massive_sitemap-2.0.0.rc2 lib/massive_sitemap/builder/index.rb
massive_sitemap-2.0.0.rc1 lib/massive_sitemap/builder/index.rb