class Codeclimate::Collectors::Validations::TypeValidator

Public Instance Methods

validate_each(record, attr_name, value) click to toggle source
# File lib/codeclimate/collectors/validations/type_validator.rb, line 5
def validate_each(record, attr_name, value)
  type = options.fetch(:type)
  if !value.nil? && !value.is_a?(type)
    record.errors.add(attr_name, "must be a #{type}")
  end
end