call (DataMapper::Validate::LengthValidator)

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

            field_value = '' if field_value.nil?

            # XXX: HACK seems hacky to do this on every validation, probably should
            #      do this elsewhere?
            field = Extlib::Inflection.humanize(field_name)
            min = @range ? @range.min : @min
            max = @range ? @range.max : @max
            equal = @equal

            case @validation_method
            when :range then
              unless valid = @range.include?(field_value.size)
                error_message = ValidationErrors.default_error_message(:length_between, field, min, max)
              end
            when :min then
              unless valid = field_value.size >= min
                error_message = ValidationErrors.default_error_message(:too_short, field, min)
              end
            when :max then
              unless valid = field_value.size <= max
                error_message = ValidationErrors.default_error_message(:too_long, field, max)
              end
            when :equals then
              unless valid = field_value.size == equal
                error_message = ValidationErrors.default_error_message(:wrong_length, field, equal)
              end
            end

            error_message = @options[:message] || error_message

            add_error(target, error_message, field_name) unless valid

            return valid
          end