Class: SitemapGenerator::Builder::SitemapIndexUrl
- Inherits:
-
SitemapUrl
- Object
- Hash
- SitemapUrl
- SitemapGenerator::Builder::SitemapIndexUrl
- Defined in:
- lib/sitemap_generator/builder/sitemap_index_url.rb
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ SitemapIndexUrl
constructor
A new instance of SitemapIndexUrl.
-
#to_xml(builder = nil) ⇒ Object
Return the URL as XML.
Methods inherited from SitemapUrl
Constructor Details
#initialize(path, options = {}) ⇒ SitemapIndexUrl
Returns a new instance of SitemapIndexUrl.
7 8 9 10 11 12 13 14 15 |
# File 'lib/sitemap_generator/builder/sitemap_index_url.rb', line 7 def initialize(path, ={}) if index = path.is_a?(SitemapGenerator::Builder::SitemapIndexFile) && path = SitemapGenerator::Utilities.reverse_merge(, :host => index.location.host, :lastmod => Time.now, :changefreq => 'always', :priority => 1.0) path = index.location.path_in_public super(path, ) else super end end |
Instance Method Details
#to_xml(builder = nil) ⇒ Object
Return the URL as XML
18 19 20 21 22 23 24 25 |
# 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 |