Sha256: af3af1331f83da6a2a2666798c8e806625903f958356711b2814f5eb6ca5d442

Contents?: true

Size: 833 Bytes

Versions: 4

Compression:

Stored size: 833 Bytes

Contents

require 'builder'

module SitemapGenerator
  module Builder
    class SitemapIndexUrl < SitemapUrl

      def initialize(path, options={})
        if index = path.is_a?(SitemapGenerator::Builder::SitemapIndexFile) && path
          options = SitemapGenerator::Utilities.reverse_merge(options, :host => index.location.host, :lastmod => Time.now, :priority => 1.0)
          path = index.location.path_in_public
          super(path, options)
        else
          super
        end
      end

      # Return the URL as XML
      def to_xml(builder=nil)
        builder = ::Builder::XmlMarkup.new if builder.nil?
        builder.sitemap do
          builder.loc        self[:loc]
          builder.lastmod    w3c_date(self[:lastmod])   if self[:lastmod]
        end
        builder << '' # force to string
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/sitemap_generator-6.3.0/lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-6.3.0 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-6.2.1 lib/sitemap_generator/builder/sitemap_index_url.rb
sitemap_generator-6.2.0 lib/sitemap_generator/builder/sitemap_index_url.rb