Sha256: 566f0ddec7f8f19149bfae2de105e270b328ed6e890c82058cabeb2fc74bd41f
Contents?: true
Size: 391 Bytes
Versions: 5
Compression:
Stored size: 391 Bytes
Contents
module HoboFields class EmailAddress < String COLUMN_TYPE = :string def validate "is not valid" 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
5 entries across 5 versions & 1 rubygems