Class: SiteMaps::Builder::SitemapIndex::Item
- Inherits:
-
Struct
- Object
- Struct
- SiteMaps::Builder::SitemapIndex::Item
- Extended by:
- Forwardable
- Defined in:
- lib/site_maps/builder/sitemap_index/item.rb
Instance Attribute Summary collapse
-
#lastmod ⇒ Object
Returns the value of attribute lastmod.
-
#loc ⇒ Object
Returns the value of attribute loc.
Instance Method Summary collapse
Instance Attribute Details
#lastmod ⇒ Object
Returns the value of attribute lastmod
3 4 5 |
# File 'lib/site_maps/builder/sitemap_index/item.rb', line 3 def lastmod @lastmod end |
#loc ⇒ Object
Returns the value of attribute loc
3 4 5 |
# File 'lib/site_maps/builder/sitemap_index/item.rb', line 3 def loc @loc end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
15 16 17 |
# File 'lib/site_maps/builder/sitemap_index/item.rb', line 15 def eql?(other) loc == other.loc end |
#hash ⇒ Object
20 21 22 |
# File 'lib/site_maps/builder/sitemap_index/item.rb', line 20 def hash loc.hash end |
#relative_directory ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/site_maps/builder/sitemap_index/item.rb', line 24 def relative_directory return unless loc =~ %r{^https?://[^/]+(/.*)$} val = File.dirname(Regexp.last_match(1)) val = val[1..] if val.start_with?("/") val end |
#to_xml ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/site_maps/builder/sitemap_index/item.rb', line 6 def to_xml builder = ::Builder::XmlMarkup.new builder.sitemap do builder.loc(loc) builder.lastmod w3c_date(lastmod) if lastmod end builder << "\n" end |