Class: DataAnon::Strategy::Field::AnonymizeArray

Inherits:
Object
  • Object
show all
Defined in:
lib/strategy/field/anonymize_array.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strategy) ⇒ AnonymizeArray

Returns a new instance of AnonymizeArray.


12
13
14
# File 'lib/strategy/field/anonymize_array.rb', line 12

def initialize strategy
  @strategy = strategy
end

Class Method Details

.user_defaults(user_defaults) ⇒ Object


8
9
10
# File 'lib/strategy/field/anonymize_array.rb', line 8

def self.user_defaults user_defaults
  @@user_defaults = user_defaults
end

Instance Method Details

#anonymize(field) ⇒ Object


16
17
18
19
20
21
# File 'lib/strategy/field/anonymize_array.rb', line 16

def anonymize field
  field.value.collect do |v|
    strategy = @strategy || @@user_defaults[v.class.to_s.downcase.to_sym]
    strategy.anonymize DataAnon::Core::Field.new(field.name, v, field.row_number, field.ar_record, field.table_name)
  end
end