Module: Bounga::ActiveRecord::Validations

Defined in:
lib/ar-validations.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

RE_EMAIL_NAME =

what you actually see in practice

'[\w\.%\+\-]+'
RE_DOMAIN_HEAD =

RE_EMAIL_NAME = ‘0-9A-Z!#$%&'*+_/=?^-`{|}~.’ # technically allowed by RFC-2822

'(?:[A-Z0-9\-]+\.)+'
RE_DOMAIN_TLD =
'(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)'
RE_EMAIL_OK =
/\A#{RE_EMAIL_NAME}@#{RE_DOMAIN_HEAD}#{RE_DOMAIN_TLD}\z/i
MSG_EMAIL_BAD =
"should look like an email address."
RE_URL_OK =
/^(http|https|ftp)/i
MSG_URL_BAD =
"should be a valid url."

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



15
16
17
# File 'lib/ar-validations.rb', line 15

def self.included(base)
  base.extend ClassMethods
end