5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-24 13:36:21 +00:00
panel/app/models/metadata_email.rb

23 lines
451 B
Ruby
Raw Permalink Normal View History

2020-01-22 20:38:22 +00:00
# frozen_string_literal: true
# Un campo de correo
2023-10-06 14:55:25 +00:00
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