Class: Katello::Validators::ContainerImageNameValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Katello::Validators::ContainerImageNameValidator
- Defined in:
- app/lib/katello/validators/container_image_name_validator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.validate_name(name) ⇒ Object
10 11 12 13 14 15 |
# File 'app/lib/katello/validators/container_image_name_validator.rb', line 10 def self.validate_name(name) if name.empty? || name.length > 255 || !/\A([a-z0-9]+[a-z0-9\-\_\.]*)+(\/[a-z0-9]+[a-z0-9\-\_\.]*)*\z/.match?(name) return false end true end |
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 8 |
# File 'app/lib/katello/validators/container_image_name_validator.rb', line 4 def validate_each(record, attribute, value) if value && !ContainerImageNameValidator.validate_name(value) record.errors[attribute] << N_("invalid container image name") end end |