Class: Gitlab::Config::Entry::Validators::TypeValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Gitlab::Config::Entry::Validators::TypeValidator
- Defined in:
- lib/gitlab/config/entry/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
329 330 331 332 333 334 335 336 337 338 |
# File 'lib/gitlab/config/entry/validators.rb', line 329 def validate_each(record, attribute, value) type = [:with] raise unless type.is_a?(Class) unless value.is_a?(type) article = type.name.match?(/\A[aeiou]/i) ? 'an' : 'a' = [:message] || "should be #{article} #{type.name.downcase}" record.errors.add(attribute, ) end end |