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.
9 10 11 12 13 14 15 16 17 |
# File 'lib/sitemap_generator/builder/sitemap_index_url.rb', line 9 def initialize(path, ={}) if index = path.is_a?(SitemapGenerator::Builder::SitemapIndexFile) && path = SitemapGenerator::Utilities.reverse_merge(, :host => index.location.host, :lastmod => Time.now, :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
20 21 22 23 24 25 26 27 |
# File 'lib/sitemap_generator/builder/sitemap_index_url.rb', line 20 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 |