Module: ActiveRecordAnonymizer
- Defined in:
- lib/active_record_anonymizer.rb,
lib/active_record_anonymizer/railtie.rb,
lib/active_record_anonymizer/version.rb,
lib/active_record_anonymizer/encryptor.rb,
lib/active_record_anonymizer/initiator.rb,
lib/active_record_anonymizer/extensions.rb,
lib/active_record_anonymizer/fake_value.rb,
lib/active_record_anonymizer/configuration.rb,
lib/active_record_anonymizer/attributes_anonymizer.rb,
lib/generators/active_record_anonymizer/install_generator.rb,
lib/generators/active_record_anonymizer/anonymize_generator.rb
Defined Under Namespace
Modules: Extensions
Classes: AnonymizeGenerator, AttributesAnonymizer, ColumnNotFoundError, Configuration, Encryptor, Error, FakeValue, Initiator, InstallGenerator, InvalidArgumentsError, Railtie, UnknownColumnTypeError, UnsupportedVersionError
Constant Summary
collapse
- VERSION =
"0.2.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.loader ⇒ Object
Returns the value of attribute loader.
21
22
23
|
# File 'lib/active_record_anonymizer.rb', line 21
def loader
@loader
end
|
Class Method Details
.alias_enabled? ⇒ Boolean
56
57
58
59
60
|
# File 'lib/active_record_anonymizer.rb', line 56
def alias_enabled?
@mutex.synchronize do
configuration.alias_original_columns
end
end
|
.anonymization_enabled? ⇒ Boolean
50
51
52
53
54
|
# File 'lib/active_record_anonymizer.rb', line 50
def anonymization_enabled?
@mutex.synchronize do
configuration.environments.include?(Rails.env.to_sym)
end
end
|
.configuration ⇒ Object
42
43
44
|
# File 'lib/active_record_anonymizer.rb', line 42
def configuration
@configuration ||= Configuration.new
end
|
36
37
38
39
40
|
# File 'lib/active_record_anonymizer.rb', line 36
def configure
@mutex.synchronize do
yield configuration if block_given?
end
end
|
.eager_load! ⇒ Object
46
47
48
|
# File 'lib/active_record_anonymizer.rb', line 46
def eager_load!
loader.eager_load
end
|
.load_model(klass_name) ⇒ Object
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/active_record_anonymizer.rb', line 62
def load_model(klass_name)
model = klass_name.safe_constantize
raise Error, "Could not find class: #{klass_name}" unless model
unless models.include?(model)
raise Error, "#{klass_name} is not an anonymized model"
end
model
end
|
.models ⇒ Object
30
31
32
33
34
|
# File 'lib/active_record_anonymizer.rb', line 30
def models
@mutex.synchronize do
@models ||= []
end
end
|
.register_model(model) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/active_record_anonymizer.rb', line 23
def register_model(model)
@mutex.synchronize do
@models ||= []
@models << model unless @models.include?(model)
end
end
|