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