call (DataMapper::Validate::FormatValidator)

    # File lib/dm-validations/validators/format_validator.rb, line 26
          def call(target)
            value = target.validation_property_value(field_name)
            return true if @options[:allow_nil] && value.blank?

            validation = @options[:as] || @options[:with]

            raise "No such predefined format '#{validation}'" if validation.is_a?(Symbol) && !FORMATS.has_key?(validation)
            validator = validation.is_a?(Symbol) ? FORMATS[validation][0] : validation

            valid = case validator
              when Proc   then validator.call(value)
              when Regexp then (value.is_a?(Fixnum) ? value.to_s : value) =~ validator
              else
                raise UnknownValidationFormat, "Can't determine how to validate #{target.class}##{field_name} with #{validator.inspect}"
            end

            return true if valid

            error_message = @options[:message] || ValidationErrors.default_error_message(:invalid, field_name)
            add_error(target, error_message.try_call(humanized_field_name, value), field_name)

            false
          end