Class: Mrsk::Utils::Sensitive

Inherits:
Object
  • Object
show all
Includes:
SSHKit::Redaction
Defined in:
lib/mrsk/utils/sensitive.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, redaction: "[REDACTED]") ⇒ Sensitive

Returns a new instance of Sensitive.



11
12
13
# File 'lib/mrsk/utils/sensitive.rb', line 11

def initialize(value, redaction: "[REDACTED]")
  @unredacted, @redaction = value, redaction
end

Instance Attribute Details

#redactionObject (readonly)

Returns the value of attribute redaction.



7
8
9
# File 'lib/mrsk/utils/sensitive.rb', line 7

def redaction
  @redaction
end

#unredactedObject (readonly)

Returns the value of attribute unredacted.



7
8
9
# File 'lib/mrsk/utils/sensitive.rb', line 7

def unredacted
  @unredacted
end

Instance Method Details

#encode_with(coder) ⇒ Object

Sensitive values won’t leak into YAML output.



16
17
18
# File 'lib/mrsk/utils/sensitive.rb', line 16

def encode_with(coder)
  coder.represent_scalar nil, redaction
end