Class: Cocina::Models::Validators::CatalogLinksValidator
- Inherits:
-
Object
- Object
- Cocina::Models::Validators::CatalogLinksValidator
- Defined in:
- lib/cocina/models/validators/catalog_links_validator.rb
Overview
Validates that only a single CatalogLink has refresh set to true
Constant Summary collapse
- MAX_REFRESH_CATALOG_LINKS =
1
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(clazz, attributes) ⇒ CatalogLinksValidator
constructor
A new instance of CatalogLinksValidator.
- #validate ⇒ Object
Constructor Details
#initialize(clazz, attributes) ⇒ CatalogLinksValidator
Returns a new instance of CatalogLinksValidator.
14 15 16 17 |
# File 'lib/cocina/models/validators/catalog_links_validator.rb', line 14 def initialize(clazz, attributes) @clazz = clazz @attributes = attributes end |
Class Method Details
.validate(clazz, attributes) ⇒ Object
10 11 12 |
# File 'lib/cocina/models/validators/catalog_links_validator.rb', line 10 def self.validate(clazz, attributes) new(clazz, attributes).validate end |
Instance Method Details
#validate ⇒ Object
19 20 21 22 23 24 |
# File 'lib/cocina/models/validators/catalog_links_validator.rb', line 19 def validate return unless meets_preconditions? validate_catalog('symphony') validate_catalog('folio') end |