Class: Gitlab::Config::Entry::Validators::AlphanumericValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Gitlab::Config::Entry::Validators::AlphanumericValidator
- Defined in:
- lib/gitlab/config/entry/validators.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.validate(value) ⇒ Object
356 357 358 |
# File 'lib/gitlab/config/entry/validators.rb', line 356 def self.validate(value) value.is_a?(String) || value.is_a?(Symbol) || value.is_a?(Integer) end |
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
360 361 362 363 364 |
# File 'lib/gitlab/config/entry/validators.rb', line 360 def validate_each(record, attribute, value) unless self.class.validate(value) record.errors.add(attribute, 'must be an alphanumeric string') end end |