Class: Legion::Extensions::Privatecore::Helpers::Erasure
- Inherits:
-
Object
- Object
- Legion::Extensions::Privatecore::Helpers::Erasure
- Defined in:
- lib/legion/extensions/privatecore/helpers/erasure.rb
Instance Attribute Summary collapse
-
#audit_log ⇒ Object
readonly
Returns the value of attribute audit_log.
Instance Method Summary collapse
- #erase_by_partition(traces, partition_id) ⇒ Object
- #erase_by_type(traces, type) ⇒ Object
- #full_erasure(traces) ⇒ Object
-
#initialize ⇒ Erasure
constructor
A new instance of Erasure.
Constructor Details
#initialize ⇒ Erasure
Returns a new instance of Erasure.
10 11 12 |
# File 'lib/legion/extensions/privatecore/helpers/erasure.rb', line 10 def initialize @audit_log = [] end |
Instance Attribute Details
#audit_log ⇒ Object (readonly)
Returns the value of attribute audit_log.
8 9 10 |
# File 'lib/legion/extensions/privatecore/helpers/erasure.rb', line 8 def audit_log @audit_log end |
Instance Method Details
#erase_by_partition(traces, partition_id) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/legion/extensions/privatecore/helpers/erasure.rb', line 21 def erase_by_partition(traces, partition_id) erased = traces.count { |t| t[:partition_id] == partition_id } traces.reject! { |t| t[:partition_id] == partition_id } record_audit(:erase_by_partition, partition_id: partition_id, count: erased) erased end |
#erase_by_type(traces, type) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/legion/extensions/privatecore/helpers/erasure.rb', line 14 def erase_by_type(traces, type) erased = traces.count { |t| t[:trace_type] == type } traces.reject! { |t| t[:trace_type] == type } record_audit(:erase_by_type, type: type, count: erased) erased end |
#full_erasure(traces) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/legion/extensions/privatecore/helpers/erasure.rb', line 28 def full_erasure(traces) count = traces.size traces.clear record_audit(:full_erasure, count: count) count end |