class LIVR::Rules::Special::Email
Public Instance Methods
call(value, user_data, field_results)
click to toggle source
# File lib/livr/rules/special.rb, line 6 def call(value, user_data, field_results) return if is_no_value(value) return 'FORMAT_ERROR' if !is_primitive(value) value = value.to_s email_re = /^([\w\-_+]+(?:\.[\w\-_+]+)*)@((?:[\w\-]+\.)*\w[\w\-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i return "WRONG_EMAIL" unless email_re.match(value) return "WRONG_EMAIL" if /\@.*\@/.match(value) return "WRONG_EMAIL" if /\@.*_/.match(value) return end