Class: DataAnon::Strategy::Field::GmailTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/strategy/field/email/gmail_template.rb

Overview

Generates a valid unique gmail address by taking advantage of the gmail + strategy. Takes in a valid gmail username and generates emails of the form username+<number>@gmail.com

anonymize('Email').using FieldStrategy::GmailTemplate.new('username')

Instance Method Summary collapse

Constructor Details

#initialize(username = 'someusername') ⇒ GmailTemplate

Returns a new instance of GmailTemplate.


14
15
16
# File 'lib/strategy/field/email/gmail_template.rb', line 14

def initialize username = 'someusername'
  @username = username
end

Instance Method Details

#anonymize(field) ⇒ Object


18
19
20
# File 'lib/strategy/field/email/gmail_template.rb', line 18

def anonymize field
  "#{@username}+#{field.row_number}@gmail.com"
end