Class: SiteValidator::Sitemap
- Inherits:
-
Object
- Object
- SiteValidator::Sitemap
- Defined in:
- lib/site_validator/sitemap.rb
Overview
A sitemap has an URL, and holds a collection of pages to be validated
Instance Attribute Summary collapse
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#errors ⇒ Object
Returns the combined validation errors of all the pages.
-
#get_binding ⇒ Object
Returns the binding, needed to paint the ERB template when generating the HTML report (see site_validator/reporter.rb).
-
#initialize(url, timeout = 20) ⇒ Sitemap
constructor
A new instance of Sitemap.
-
#pages ⇒ Object
Returns the first 250 unique URLs from the sitemap.
-
#warnings ⇒ Object
Returns the combined validation warnings of all the pages.
Constructor Details
#initialize(url, timeout = 20) ⇒ Sitemap
Returns a new instance of Sitemap.
14 15 16 17 |
# File 'lib/site_validator/sitemap.rb', line 14 def initialize(url, timeout = 20) @url = url @timeout = timeout end |
Instance Attribute Details
#timeout ⇒ Object
Returns the value of attribute timeout.
12 13 14 |
# File 'lib/site_validator/sitemap.rb', line 12 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
12 13 14 |
# File 'lib/site_validator/sitemap.rb', line 12 def url @url end |
Instance Method Details
#errors ⇒ Object
Returns the combined validation errors of all the pages
27 28 29 |
# File 'lib/site_validator/sitemap.rb', line 27 def errors @errors ||= pages.map {|p| p.errors}.flatten.reject {|e| e.nil?} end |
#get_binding ⇒ Object
Returns the binding, needed to paint the ERB template when generating the HTML report (see site_validator/reporter.rb)
40 41 42 |
# File 'lib/site_validator/sitemap.rb', line 40 def get_binding binding end |
#pages ⇒ Object
Returns the first 250 unique URLs from the sitemap
21 22 23 |
# File 'lib/site_validator/sitemap.rb', line 21 def pages @pages ||= pages_in_sitemap.uniq {|p| p.url}[0..249] end |
#warnings ⇒ Object
Returns the combined validation warnings of all the pages
33 34 35 |
# File 'lib/site_validator/sitemap.rb', line 33 def warnings @warnings ||= pages.map {|p| p.warnings}.flatten.reject {|e| e.nil?} end |