Class: Indexmap::Validator
- Inherits:
-
Object
- Object
- Indexmap::Validator
- Defined in:
- lib/indexmap/validator.rb
Instance Method Summary collapse
-
#initialize(configuration: Indexmap.configuration, filename: nil) ⇒ Validator
constructor
A new instance of Validator.
- #validate! ⇒ Object
Constructor Details
#initialize(configuration: Indexmap.configuration, filename: nil) ⇒ Validator
Returns a new instance of Validator.
10 11 12 13 |
# File 'lib/indexmap/validator.rb', line 10 def initialize(configuration: Indexmap.configuration, filename: nil) @configuration = configuration @filename = filename end |
Instance Method Details
#validate! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/indexmap/validator.rb', line 15 def validate! sitemap_filename = filename || configuration.index_filename raise ValidationError, "Missing sitemap file: #{sitemap_filename}" unless storage.exist?(sitemap_filename) validate_sitemap_file!(sitemap_filename) entries = Parser.new(source: sitemap_filename, storage: storage, index_filename: configuration.index_filename).entries validate_presence!(entries) validate_duplicates!(entries) validate_parameterized_urls!(entries) validate_fragment_urls!(entries) validate_absolute_http_urls!(entries) validate_same_host_urls!(entries) validate_lastmods!(entries) true end |