Class: TypeValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/ansible/ruby/models/type_validator.rb

Overview

See LICENSE.txt for license

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/ansible/ruby/models/type_validator.rb', line 4

def validate_each(record, attribute, value)
  # Don't worry about this case, different validator
  return if value.is_a? NilClass
  failed = perform_validation(attribute, value)
  return unless failed
  failed = custom_error(value) if options[:message]
  record.errors[attribute] << failed
end