Module: Deidentify

Extended by:
ActiveSupport::Concern
Defined in:
lib/deidentify.rb,
lib/deidentify/keep.rb,
lib/deidentify/error.rb,
lib/deidentify/delete.rb,
lib/deidentify/replace.rb,
lib/deidentify/hash_url.rb,
lib/deidentify/base_hash.rb,
lib/deidentify/hash_email.rb,
lib/deidentify/configuration.rb,
lib/deidentify/delocalize_ip.rb,
lib/generators/deidentify/configure_for_generator.rb

Defined Under Namespace

Modules: ClassMethods, Generators Classes: BaseHash, Configuration, Delete, DelocalizeIp, Error, HashEmail, HashUrl, Keep, Replace

Constant Summary collapse

POLICY_MAP =
{
  replace: Deidentify::Replace,
  delete: Deidentify::Delete,
  hash: Deidentify::BaseHash,
  hash_email: Deidentify::HashEmail,
  hash_url: Deidentify::HashUrl,
  keep: Deidentify::Keep,
  delocalize_ip: Deidentify::DelocalizeIp
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configurationObject



15
16
17
# File 'lib/deidentify.rb', line 15

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



19
20
21
# File 'lib/deidentify.rb', line 19

def configure
  yield(configuration)
end

Instance Method Details

#deidentify!(validate: true) ⇒ Object



61
62
63
64
65
66
# File 'lib/deidentify.rb', line 61

def deidentify!(validate: true)
  scope = Deidentify.configuration.scope
  return self if scope && scope.call(self.class).find_by(id: id).nil?

  recursive_deidentify!(validate: validate, deidentified_objects: [])
end

#deidentify_attributesObject



68
69
70
71
72
# File 'lib/deidentify.rb', line 68

def deidentify_attributes
  deidentify_configuration.each_pair do |col, config|
    deidentify_column(col, config)
  end
end