class PoroValidator::Validators::FormatValidator
Public Instance Methods
validate(attribute, value, options)
click to toggle source
# File lib/poro_validator/validators/format_validator.rb, line 4 def validate(attribute, value, options) return if value.nil? pattern = options.fetch(:with) message = options.fetch(:message, :format) unless value.to_s =~ pattern errors.add(attribute, message, pattern) end end