class Veto::MinLengthCheck

Public Instance Methods

check(attribute, value, errors, options={}) click to toggle source
# File lib/veto/checks/min_length_check.rb, line 3
def check(attribute, value, errors, options={})
        min = options.fetch(:with)
        message = options.fetch(:message, :min_length)
        on = options.fetch(:on, attribute)
        
        if value.nil? || value.length < min
                errors.add(on, message, min)
        end
end