Class: DataAnon::Strategy::Field::RandomLastName
- Inherits:
-
SelectFromFile
- Object
- SelectFromFile
- DataAnon::Strategy::Field::RandomLastName
- 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
-
#initialize(file_path = nil) ⇒ RandomLastName
constructor
A new instance of RandomLastName.
Methods inherited from SelectFromFile
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 |