Class: MiniDefender::Rules::Email
Class Method Summary
collapse
Instance Method Summary
collapse
#active?, available?, #bails?, #default_value, #defaults?, #error_message, #excluded?, #force_coerce?, #implicit?, make, #priority, #stops?, #with_message
Class Method Details
.signature ⇒ Object
4
5
6
|
# File 'lib/mini_defender/rules/email.rb', line 4
def self.signature
'email'
end
|
Instance Method Details
#coerce(value) ⇒ Object
8
9
10
|
# File 'lib/mini_defender/rules/email.rb', line 8
def coerce(value)
value.strip.downcase
end
|
#message(attribute, value, validator) ⇒ Object
16
17
18
|
# File 'lib/mini_defender/rules/email.rb', line 16
def message(attribute, value, validator)
"The value should be a valid email address."
end
|
#passes?(attribute, value, validator) ⇒ Boolean
12
13
14
|
# File 'lib/mini_defender/rules/email.rb', line 12
def passes?(attribute, value, validator)
value.to_s.match?(URI::MailTo::EMAIL_REGEXP)
end
|