class Veto::ExactLengthCheck

Private Instance Methods

check(attribute, value, errors, options={}) click to toggle source
# File lib/veto/checks/exact_length_check.rb, line 6
def check(attribute, value, errors, options={})
        exact = options.fetch(:with)
        message = options.fetch(:message, :exact_length)
        on = options.fetch(:on, attribute)
        
        if value.nil? || value.length != exact
                errors.add(on, message, exact)
        end
end