Sha256: e4c58f2bdb0c9e6d104b5b6e2d4c3ec4c07f0d84112ce112663d6ccd10233e27

Contents?: true

Size: 347 Bytes

Versions: 2

Compression:

Stored size: 347 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', 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.8 lib/codebreaker/mixins/validator.rb
cb-core-0.1.7 lib/codebreaker/mixins/validator.rb