Class: DataAnon::Strategy::Field::RandomFirstName
- Inherits:
-
SelectFromFile
- Object
- SelectFromFile
- DataAnon::Strategy::Field::RandomFirstName
- Defined in:
- lib/strategy/field/name/random_first_name.rb
Overview
Randomly picks up first name from the predefined list in the file. Default [file](raw.github.com/sunitparekh/data-anonymization/master/resources/first_names.txt) is part of the gem. File should contain first name on each line.
!!!ruby ```ruby
anonymize('FirstName').using FieldStrategy::RandomFirstName.new
!!!ruby
anonymize('FirstName').using FieldStrategy::RandomFirstName.new('my_first_names.txt')
Instance Method Summary collapse
-
#initialize(file_path = nil) ⇒ RandomFirstName
constructor
A new instance of RandomFirstName.
Methods inherited from SelectFromFile
Constructor Details
#initialize(file_path = nil) ⇒ RandomFirstName
Returns a new instance of RandomFirstName.
17 18 19 |
# File 'lib/strategy/field/name/random_first_name.rb', line 17 def initialize file_path = nil super(file_path || DataAnon::Utils::Resource.file('first_names.txt')) end |