class SitemapGenerator::Builder::SitemapIndexUrl

Public Class Methods

new(path, options={}) click to toggle source
Calls superclass method
# File lib/sitemap_generator/builder/sitemap_index_url.rb, line 7
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, :changefreq => 'always', :priority => 1.0)
    path = index.location.path_in_public
    super(path, options)
  else
    super
  end
end

Public Instance Methods

to_xml(builder=nil) click to toggle source

Return the URL as XML

# File lib/sitemap_generator/builder/sitemap_index_url.rb, line 18
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