class HoboFields::Types::EmailAddress

Constants

COLUMN_TYPE

Public Instance Methods

to_html(xmldoctype = true) click to toggle source
# File lib/hobo_fields/types/email_address.rb, line 17
def to_html(xmldoctype = true)
  ERB::Util.html_escape(self).sub('@', " at ").gsub('.', ' dot ').html_safe
end
valid?() click to toggle source
# File lib/hobo_fields/types/email_address.rb, line 13
def valid?
  self =~ /^\s*([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\s*$/
end
validate() click to toggle source
# File lib/hobo_fields/types/email_address.rb, line 9
def validate
  I18n.t("errors.messages.invalid") unless valid? || blank?
end