Sha256: ead6a97c995402ca889645b1c0a903cda4d2048bbf4c8d2932711874053c30ff
Contents?: true
Size: 787 Bytes
Versions: 2
Compression:
Stored size: 787 Bytes
Contents
# -*- encoding: utf-8 -*- require 'open-uri' require 'nokogiri' module W3Clove ## # A sitemap has an URL, and holds a collection of pages to be validated # class Sitemap attr_accessor :url def initialize(url) @url = url end def pages @pages ||= pages_in_sitemap.uniq {|p| p.url} end def errors @errors ||= pages.map {|p| p.errors}.flatten.reject {|e| e.nil?} end def warnings @warnings ||= pages.map {|p| p.warnings}.flatten.reject {|e| e.nil?} end def get_binding binding end private def pages_in_sitemap locations.map {|loc| W3Clove::Page.new(loc.text)} end def locations Nokogiri::XML(doc).css('loc') end def doc @doc ||= open(url) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
w3clove-0.3.1 | lib/w3clove/sitemap.rb |
w3clove-0.3.0 | lib/w3clove/sitemap.rb |