Class: IuguLogger::Pii::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/iugu_logger/pii.rb

Overview

Frozen result of a Pii scan. Logger uses this to populate the canonical pii.* block of the emitted payload.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload:, detected:, redacted_count:) ⇒ Result

Returns a new instance of Result.



137
138
139
140
141
142
# File 'lib/iugu_logger/pii.rb', line 137

def initialize(payload:, detected:, redacted_count:)
  @payload        = payload
  @detected       = detected.uniq.sort
  @redacted_count = redacted_count
  freeze
end

Instance Attribute Details

#detectedObject (readonly)

Returns the value of attribute detected.



135
136
137
# File 'lib/iugu_logger/pii.rb', line 135

def detected
  @detected
end

#payloadObject (readonly)

Returns the value of attribute payload.



135
136
137
# File 'lib/iugu_logger/pii.rb', line 135

def payload
  @payload
end

#redacted_countObject (readonly)

Returns the value of attribute redacted_count.



135
136
137
# File 'lib/iugu_logger/pii.rb', line 135

def redacted_count
  @redacted_count
end

Instance Method Details

#to_pii_blockObject



144
145
146
147
148
149
150
# File 'lib/iugu_logger/pii.rb', line 144

def to_pii_block
  {
    'scanned'  => true,
    'detected' => @detected.map(&:to_s),
    'redacted' => @redacted_count
  }
end