Class: Pseudonymize::Email
- Inherits:
-
Object
- Object
- Pseudonymize::Email
- Defined in:
- lib/pseudonymize/email.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(email, **options) ⇒ Email
constructor
A new instance of Email.
- #result ⇒ Object
Constructor Details
#initialize(email, **options) ⇒ Email
Returns a new instance of Email.
5 6 7 8 |
# File 'lib/pseudonymize/email.rb', line 5 def initialize(email, **) @email = email @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/pseudonymize/email.rb', line 3 def @options end |
Instance Method Details
#result ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pseudonymize/email.rb', line 10 def result user, host = @email.split('@') if user.length > 2 user = user[0] + ([:censor] * (user.length - 1)) else user = ([:censor] * user.length) end "#{user}@#{host}" end |