@@ -9,36 +9,36 @@ def validate_each(record, attribute, value)
9
9
10
10
private
11
11
12
- def email_invalid_error_message
13
- # options[:message] || I18n.t('errors.messages.email')
14
- ( options [ :message ] || "must be a valid email address" )
15
- end
12
+ def email_invalid_error_message
13
+ # options[:message] || I18n.t('errors.messages.email')
14
+ ( options [ :message ] || "must be a valid email address" )
15
+ end
16
16
17
- def email_contains_dots_error_message
18
- ( options [ :message ] || "must contain fewer dots" )
19
- end
17
+ def email_contains_dots_error_message
18
+ ( options [ :message ] || "must contain fewer dots" )
19
+ end
20
20
21
- def email_ends_with_dot_error_message
22
- ( options [ :message ] || "must not end with a dot" )
23
- end
21
+ def email_ends_with_dot_error_message
22
+ ( options [ :message ] || "must not end with a dot" )
23
+ end
24
24
25
- def email_valid? ( email_address )
26
- return true if email_address . blank?
25
+ def email_valid? ( email_address )
26
+ return true if email_address . blank?
27
27
28
- email_address =~ /\A ([^@\s ]+)@((?:[-a-z0-9]+\. )+[a-z]{2,})\z /i
29
- end
28
+ email_address =~ /\A ([^@\s ]+)@((?:[-a-z0-9]+\. )+[a-z]{2,})\z /i
29
+ end
30
30
31
- def handle_contains_number_of_dots ( email_address )
32
- return true if email_address . blank?
31
+ def handle_contains_number_of_dots ( email_address )
32
+ return true if email_address . blank?
33
33
34
- email_handle = email_address . split ( '@' )
35
- email_handle [ 0 ] . count ( '.' ) < 3 if ( email_handle && !email_handle . blank? )
36
- end
34
+ email_handle = email_address . split ( '@' )
35
+ email_handle [ 0 ] . count ( '.' ) < 3 if ( email_handle && !email_handle . blank? )
36
+ end
37
37
38
- def handle_last_character_is_not_dot ( email_address )
39
- return true if email_address . blank?
38
+ def handle_last_character_is_not_dot ( email_address )
39
+ return true if email_address . blank?
40
40
41
- email_handle = email_address . split ( '@' )
42
- email_handle [ 0 ] [ -1 ] != "." if ( email_handle && !email_handle . blank? )
43
- end
41
+ email_handle = email_address . split ( '@' )
42
+ email_handle [ 0 ] [ -1 ] != "." if ( email_handle && !email_handle . blank? )
43
+ end
44
44
end
0 commit comments