mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 11:46:22 +00:00
22 lines
451 B
Ruby
22 lines
451 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Un campo de correo
|
|
class MetadataEmail < MetadataString
|
|
# Aplica distintas validaciones a la cuenta de correo
|
|
#
|
|
# @return [Boolean]
|
|
def validate
|
|
super
|
|
|
|
errors << email_address.error.capitalize unless email_address.valid?
|
|
|
|
errors.empty?
|
|
end
|
|
|
|
private
|
|
|
|
# @return [EmailAddress::Address]
|
|
def email_address
|
|
@email_address ||= EmailAddress::Address.new(value, {}, I18n.locale.to_s)
|
|
end
|
|
end
|