Module: Sinatra::ParamValidator::Parameter::CommonMinMax
Overview
min/max tests
Instance Method Summary collapse
Instance Method Details
#max(maximum) ⇒ Object
73 74 75 76 77 |
# File 'lib/sinatra/param_validator/parameter/common.rb', line 73 def max(maximum) return if @coerced.respond_to?(:<=) && @coerced <= maximum @errors.push "Parameter cannot be greater than #{maximum}" end |
#min(minimum) ⇒ Object
79 80 81 82 83 |
# File 'lib/sinatra/param_validator/parameter/common.rb', line 79 def min(minimum) return if @coerced.respond_to?(:>=) && @coerced >= minimum @errors.push "Parameter cannot be less than #{minimum}" end |