class Arwen::Url

Models the sitemap <url> schema definition according the sitemap.org protocol

@see www.sitemaps.org/protocol.html#urldef

Attributes

changefreq[RW]

@return [string] <changefreq> schema value

lastmod[RW]

@return [string] <lastmod> schema value

priority[RW]

@return [float] <priority> schema value

raw[R]

The Ox::Element object used to initialize the Url instance @return [Ox::Element]

url[RW]

@return [string] <loc> schema value

Public Class Methods

new(ox_element) click to toggle source

Create a new SitemapParser::URL

@param [Ox::Element] ox_element element in the sitemap tree @see www.ohler.com/ox/Ox/Element.html

# File lib/arwen/url.rb, line 28
def initialize(ox_element)
  @url = ox_element.locate("loc/*").first
  @lastmod = ox_element.locate("lastmod/*").first
  @priority = ox_element.locate("priority/*").first&.to_f
  @changefreq = ox_element.locate("changefreq/*").first
  @raw = ox_element
end

Public Instance Methods

to_date() click to toggle source

converts the string lastmod value to a `Date` object

@return [Date]

# File lib/arwen/url.rb, line 39
def to_date
  return nil if lastmod.nil?

  Date.parse(lastmod)
end