Class: W3Clove::Sitemap
- Inherits:
-
Object
- Object
- W3Clove::Sitemap
- Defined in:
- lib/w3clove/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 w3clove/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.
15 16 17 18 |
# File 'lib/w3clove/sitemap.rb', line 15 def initialize(url, timeout = 20) @url = url @timeout = timeout end |
Instance Attribute Details
#timeout ⇒ Object
Returns the value of attribute timeout.
13 14 15 |
# File 'lib/w3clove/sitemap.rb', line 13 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
13 14 15 |
# File 'lib/w3clove/sitemap.rb', line 13 def url @url end |
Instance Method Details
#errors ⇒ Object
Returns the combined validation errors of all the pages
28 29 30 |
# File 'lib/w3clove/sitemap.rb', line 28 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 w3clove/reporter.rb)
41 42 43 |
# File 'lib/w3clove/sitemap.rb', line 41 def get_binding binding end |
#pages ⇒ Object
Returns the first 250 unique URLs from the sitemap
22 23 24 |
# File 'lib/w3clove/sitemap.rb', line 22 def pages @pages ||= pages_in_sitemap.uniq {|p| p.url}[0..249] end |
#warnings ⇒ Object
Returns the combined validation warnings of all the pages
34 35 36 |
# File 'lib/w3clove/sitemap.rb', line 34 def warnings @warnings ||= pages.map {|p| p.warnings}.flatten.reject {|e| e.nil?} end |