Class: DataAnon::Strategy::Field::RandomLastName

Inherits:
SelectFromFile show all
Defined in:
lib/strategy/field/name/random_last_name.rb

Overview

Randomly picks up last name from the predefined list in the file. Default [file](raw.github.com/sunitparekh/data-anonymization/master/resources/last_names.txt) is part of the gem. File should contain last name on each line.

anonymize('LastName').using FieldStrategy::RandomLastName.new

!!!ruby
anonymize('LastName').using FieldStrategy::RandomLastName.new('my_last_names.txt')

Instance Method Summary collapse

Methods inherited from SelectFromFile

#anonymize

Constructor Details

#initialize(file_path = nil) ⇒ RandomLastName

Returns a new instance of RandomLastName.


16
17
18
# File 'lib/strategy/field/name/random_last_name.rb', line 16

def initialize file_path = nil
  super(file_path || DataAnon::Utils::Resource.file('last_names.txt'))
end