Module: Xcopier::Anonymizer
- Defined in:
- lib/xcopier/anonymizer.rb
Constant Summary collapse
- RULES =
rubocop:disable Style/MutableConstant
{ # rubocop:disable Style/MutableConstant /email/ => -> { Faker::Internet.email }, /first_?name/ => -> { Faker::Name.first_name }, /last_?name/ => -> { Faker::Name.last_name }, /name/ => -> { Faker::Name.name }, /phone/ => -> { Faker::PhoneNumber.phone_number }, /address/ => -> { Faker::Address.full_address }, /city/ => -> { Faker::Address.city }, /country/ => -> { Faker::Address.country }, /zip/ => -> { Faker::Address.zip_code }, /(company|organization)/ => -> { Faker::Company.name } }
Class Method Summary collapse
Class Method Details
.anonymize(name, value) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/xcopier/anonymizer.rb', line 25 def anonymize(name, value) unless defined?(Faker) puts "[WARN] Please add the faker gem to your Gemfile to be able to automatic annonimize data" return value end RULES.each do |rule, block| return block.call if name.match?(rule) end value end |