Sha256: 93bc90f89f127edc72449aac2ce088b7f6cc12d410e1c52e937c4f3ae2588f3e
Contents?: true
Size: 423 Bytes
Versions: 17
Compression:
Stored size: 423 Bytes
Contents
module HoboFields class EmailAddress < String COLUMN_TYPE = :string def validate I18n.t("activerecord.errors.messages.invalid") unless valid? || blank? end def valid? self =~ /^\s*([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\s*$/i end def to_html(xmldoctype = true) self.sub('@', " at ").gsub('.', ' dot ') end HoboFields.register_type(:email_address, self) end end
Version data entries
17 entries across 17 versions & 1 rubygems