Sha256: e309f8b2fd6055af88399df611b0e132c9d953cd8d9560df66ee50ee55b070dd
Contents?: true
Size: 425 Bytes
Versions: 12
Compression:
Stored size: 425 Bytes
Contents
module Validatable class ValidatesFormatOf < ValidationBase #:nodoc: attr_accessor :with def valid?(instance) value = instance.send(self.attribute) return true if allow_nil && value.nil? return true if allow_blank && (!value or (value.respond_to?(:empty?) and value.empty?)) not (value.to_s =~ self.with).nil? end def message(instance) super || "is invalid" end end end
Version data entries
12 entries across 12 versions & 1 rubygems