Sha256: d766c4750abec369b4046caf9cba4a78e0107b547c79b64b214685b985cc8219

Contents?: true

Size: 356 Bytes

Versions: 2

Compression:

Stored size: 356 Bytes

Contents

module Codebreaker
  module Mixins
    module Validator
      def validate_length(value, min, max)
        return if value.instance_of?(String) && value.size.between?(min, max)

        raise Codebreaker::Errors::ValidationLengthError,
              I18n.t('errors.validation_length_detailed', value: value, min: min, max: max)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cb-core-0.1.10 lib/codebreaker/mixins/validator.rb
cb-core-0.1.9 lib/codebreaker/mixins/validator.rb