Module: Sinatra::ParamValidator::Parameter::CommonMinMaxLength
Overview
min/max length tests
Instance Method Summary collapse
Instance Method Details
#max_length(length) ⇒ Object
88 89 90 91 92 |
# File 'lib/sinatra/param_validator/parameter/common.rb', line 88 def max_length(length) return if @coerced.respond_to?(:length) && @coerced.length <= length @errors.push "Parameter cannot have length greater than #{length}" end |
#min_length(length) ⇒ Object
94 95 96 97 98 |
# File 'lib/sinatra/param_validator/parameter/common.rb', line 94 def min_length(length) return if @coerced.respond_to?(:length) && @coerced.length >= length @errors.push "Parameter cannot have length less than #{length}" end |