Module: W3Clove::Validator
Overview
Validator module is the one in charge of doing the validation loop for all pages on a sitemap and output the errors
Instance Attribute Summary collapse
-
#printer ⇒ Object
writeonly
Sets the attribute printer.
Instance Method Summary collapse
-
#check(url, filename, timeout) ⇒ Object
Parses a remote xml sitemap and checks markup validation for each url Shows progress on dot-style (…F…FFE..).
Instance Attribute Details
#printer=(value) ⇒ Object
Sets the attribute printer
9 10 11 |
# File 'lib/w3clove/validator.rb', line 9 def printer=(value) @printer = value end |
Instance Method Details
#check(url, filename, timeout) ⇒ Object
Parses a remote xml sitemap and checks markup validation for each url Shows progress on dot-style (…F…FFE..). A dot is a valid page, an F is a page with errors, and an E is an exception After the checking is done, a detailed summary is written to filename
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/w3clove/validator.rb', line 18 def check(url, filename, timeout) sitemap = W3Clove::Sitemap.new(url, timeout.to_f) say "Validating #{sitemap.pages.length} pages" sitemap.pages.each do |page| say_inline page.valid? ? "." : (page.errors.nil? ? 'E' : 'F') end W3Clove::Reporter.generate_html(sitemap, filename) say "\nValidation finished, see the report at #{filename}" end |