Class: Privacy::Person
- Inherits:
-
Object
- Object
- Privacy::Person
- Defined in:
- lib/privacy/person.rb
Constant Summary collapse
- COLUMNS_TO_ANONYMIZE =
[ 'Nom _identifier_', 'Prénom _identifier_', 'Date de naissance _identifier_', 'Lieu naissance Pays _identifier_', 'Lieu naissance Ville _identifier_', 'Lieu naissance Département _identifier_', 'Sexe _identifier_', 'Nationalité _identifier_', 'Adresse _identifier_ [Date]', 'Adresse _identifier_ [Département]', 'Adresse _identifier_ [Ville]', 'Adresse _identifier_ [Pays]', 'Profession _identifier_', 'Date profession _identifier_' ]
- INITIALS_SEPARATORS =
[ '', '.' ]
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#combinations ⇒ Object
readonly
Returns the value of attribute combinations.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#initials ⇒ Object
readonly
Returns the value of attribute initials.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
Instance Method Summary collapse
- #anonymize(row, index) ⇒ Object
- #identify_columns(row) ⇒ Object
-
#initialize(identifier) ⇒ Person
constructor
A new instance of Person.
Constructor Details
#initialize(identifier) ⇒ Person
Returns a new instance of Person.
26 27 28 29 |
# File 'lib/privacy/person.rb', line 26 def initialize(identifier) @identifier = identifier puts "Identify #{identifier}" end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
2 3 4 |
# File 'lib/privacy/person.rb', line 2 def columns @columns end |
#combinations ⇒ Object (readonly)
Returns the value of attribute combinations.
2 3 4 |
# File 'lib/privacy/person.rb', line 2 def combinations @combinations end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
2 3 4 |
# File 'lib/privacy/person.rb', line 2 def data @data end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
2 3 4 |
# File 'lib/privacy/person.rb', line 2 def identifier @identifier end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
2 3 4 |
# File 'lib/privacy/person.rb', line 2 def index @index end |
#initials ⇒ Object (readonly)
Returns the value of attribute initials.
2 3 4 |
# File 'lib/privacy/person.rb', line 2 def initials @initials end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
2 3 4 |
# File 'lib/privacy/person.rb', line 2 def row @row end |
Instance Method Details
#anonymize(row, index) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/privacy/person.rb', line 45 def anonymize(row, index) @row = row @index = index + 1 # Excel is 1-indexed anonymize_personal_data build_combinations remove_combinations end |
#identify_columns(row) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/privacy/person.rb', line 31 def identify_columns(row) @columns = {} row.each do |key, value| COLUMNS_TO_ANONYMIZE.each do |column| name = column_with_identifier column if value == name letter = key.gsub '1', '' @columns[letter] = name puts " #{name} on column #{letter}" end end end end |