Class: Lyra::Privacy::PIIMasker
- Inherits:
-
Object
- Object
- Lyra::Privacy::PIIMasker
- Defined in:
- lib/lyra/privacy/pii_masker.rb
Overview
Masks PII in attribute hashes
This class delegates to PamDsl::PIIMasker for the core masking logic, providing a unified implementation across both Lyra and PAM DSL.
Class Method Summary collapse
-
.mask(attributes, strategy: :partial) ⇒ Hash
Mask all PII fields in an attributes hash.
-
.mask_events(events, strategy: :partial) ⇒ Array
Mask all PII in a collection of Lyra events.
-
.mask_field(value, field_name) ⇒ Object
Mask specific field.
Class Method Details
.mask(attributes, strategy: :partial) ⇒ Hash
Mask all PII fields in an attributes hash
24 25 26 |
# File 'lib/lyra/privacy/pii_masker.rb', line 24 def mask(attributes, strategy: :partial) PamDsl::PIIMasker.mask(attributes, strategy: strategy) end |
.mask_events(events, strategy: :partial) ⇒ Array
Mask all PII in a collection of Lyra events
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/lyra/privacy/pii_masker.rb', line 44 def mask_events(events, strategy: :partial) PamDsl::PIIMasker.mask_records( events, attribute_extractor: ->(e) { e.attributes }, attribute_setter: ->(e, masked) { Lyra::Event.new( event_id: e.event_id, operation: e.operation, model_class: e.model_class, model_id: e.model_id, attributes: masked, changes: e.changes, timestamp: e., metadata: e. ) }, strategy: strategy ) end |
.mask_field(value, field_name) ⇒ Object
Mask specific field
34 35 36 |
# File 'lib/lyra/privacy/pii_masker.rb', line 34 def mask_field(value, field_name) PamDsl::PIIMasker.mask_field(value, field_name) end |