1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Improve var names

This commit is contained in:
Matt Jankowski 2024-07-29 16:59:17 -04:00
parent be97188762
commit c37efb8afa

View file

@ -4,18 +4,18 @@ module CanonicalEmail
extend ActiveSupport::Concern extend ActiveSupport::Concern
class_methods do class_methods do
def email_to_canonical_email_hash(str) def email_to_canonical_email_hash(value)
Digest::SHA2 Digest::SHA2
.new(256) .new(256)
.hexdigest( .hexdigest(
email_to_canonical_email(str) email_to_canonical_email(value)
) )
end end
private private
def email_to_canonical_email(str) def email_to_canonical_email(value)
username, domain = str.downcase.split('@', 2) username, domain = value.downcase.split('@', 2)
username, = username.delete('.').split('+', 2) username, = username.delete('.').split('+', 2)
"#{username}@#{domain}" "#{username}@#{domain}"