mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Add private method declaration
This commit is contained in:
parent
fa07a97815
commit
2ac99032eb
1 changed files with 9 additions and 7 deletions
|
@ -4,13 +4,6 @@ module CanonicalEmail
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
def email_to_canonical_email(str)
|
|
||||||
username, domain = str.downcase.split('@', 2)
|
|
||||||
username, = username.delete('.').split('+', 2)
|
|
||||||
|
|
||||||
"#{username}@#{domain}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def email_to_canonical_email_hash(str)
|
def email_to_canonical_email_hash(str)
|
||||||
Digest::SHA2
|
Digest::SHA2
|
||||||
.new(256)
|
.new(256)
|
||||||
|
@ -18,5 +11,14 @@ module CanonicalEmail
|
||||||
email_to_canonical_email(str)
|
email_to_canonical_email(str)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def email_to_canonical_email(str)
|
||||||
|
username, domain = str.downcase.split('@', 2)
|
||||||
|
username, = username.delete('.').split('+', 2)
|
||||||
|
|
||||||
|
"#{username}@#{domain}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue