class Veto::FormatCheck

Private Instance Methods

check(attribute, value, errors, options={}) click to toggle source
# File lib/veto/checks/format_check.rb, line 6
def check(attribute, value, errors, options={})
        pattern = options.fetch(:with)
        message = options.fetch(:message, :format)
        on = options.fetch(:on, attribute)
        
        unless value.to_s =~ pattern
                errors.add(on, message)
        end
end