Class: Indexmap::Validator
- Inherits:
-
Object
- Object
- Indexmap::Validator
- Defined in:
- lib/indexmap/validator.rb
Instance Method Summary collapse
-
#initialize(configuration: Indexmap.configuration, path: nil) ⇒ Validator
constructor
A new instance of Validator.
- #validate! ⇒ Object
Constructor Details
#initialize(configuration: Indexmap.configuration, path: nil) ⇒ Validator
Returns a new instance of Validator.
5 6 7 8 |
# File 'lib/indexmap/validator.rb', line 5 def initialize(configuration: Indexmap.configuration, path: nil) @configuration = configuration @path = path end |
Instance Method Details
#validate! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/indexmap/validator.rb', line 10 def validate! sitemap_path = path || Indexmap::Path.existing_public_path( public_path: configuration.public_path, index_filename: configuration.index_filename ) raise ValidationError, "Missing sitemap file: #{sitemap_path}" unless File.exist?(sitemap_path) entries = Parser.new(path: sitemap_path).entries validate_duplicates!(entries) validate_parameterized_urls!(entries) true end |