Class: DataAnon::Strategy::Field::AnonymizeDateTime

Inherits:
AnonymizeTime
  • Object
show all
Defined in:
lib/strategy/field/datetime/anonymize_datetime.rb

Overview

Anonymizes each field(except year and seconds) within the natural range (e.g. hour between 1-24 and day within the month) based on true/false input for that field. By default, all fields are anonymized.

# anonymizes month and hour fields, leaving the day and minute fields untouched
anonymize('DateOfBirth').using FieldStrategy::AnonymizeDateTime.new(true,false,true,false)

In addition to customizing which fields you want anonymized, there are some helper methods which allow for quick anonymization

# anonymizes only the month field
anonymize('DateOfBirth').using FieldStrategy::AnonymizeDateTime.only_month
# anonymizes only the day field
anonymize('DateOfBirth').using FieldStrategy::AnonymizeDateTime.only_day
# anonymizes only the hour field
anonymize('DateOfBirth').using FieldStrategy::AnonymizeDateTime.only_hour
# anonymizes only the minute field
anonymize('DateOfBirth').using FieldStrategy::AnonymizeDateTime.only_minute

Constant Summary

Constants inherited from AnonymizeTime

DataAnon::Strategy::Field::AnonymizeTime::DEFAULT_ANONYMIZATION

Method Summary

Methods inherited from AnonymizeTime

#anonymize, #initialize, only_day, only_hour, only_minute, only_month

Constructor Details

This class inherits a constructor from DataAnon::Strategy::Field::AnonymizeTime