Module: Anony::Anonymisable
- Defined in:
- lib/anony/anonymisable.rb
Overview
The main Anony object to include in your ActiveRecord class.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#anonymise! ⇒ Anony::Result
Run all anonymisation strategies on the model instance before saving it.
- #anonymised? ⇒ Boolean
Instance Method Details
#anonymise! ⇒ Anony::Result
Run all anonymisation strategies on the model instance before saving it.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/anony/anonymisable.rb', line 97 def anonymise! unless self.class.anonymise_config raise ArgumentError, "#{self.class.name} does not have an Anony configuration" end self.class.anonymise_config.validate! if Config.validate_before_anonymisation self.class.anonymise_config.apply(self) rescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordNotDestroyed => e Result.failed(e, self) end |
#anonymised? ⇒ Boolean
108 109 110 |
# File 'lib/anony/anonymisable.rb', line 108 def anonymised? anonymised_at.present? end |