Class: OpenSearch::Transport::Redacted
- Inherits:
-
Hash
- Object
- Hash
- OpenSearch::Transport::Redacted
- Defined in:
- lib/opensearch/transport/redacted.rb
Overview
Class for wrapping a hash that could have sensitive data. When printed, the sensitive values will be redacted.
Constant Summary collapse
- SENSITIVE_KEYS =
The keys whose values will be redacted.
%i[password pwd].freeze
- STRING_REPLACEMENT =
The replacement string used in place of the value for sensitive keys.
'<REDACTED>'.freeze
Instance Method Summary collapse
-
#initialize(elements = nil) ⇒ Redacted
constructor
A new instance of Redacted.
-
#inspect ⇒ String
Get a string representation of the hash.
-
#to_s ⇒ String
Get a string representation of the hash.
Constructor Details
#initialize(elements = nil) ⇒ Redacted
Returns a new instance of Redacted.
34 35 36 37 |
# File 'lib/opensearch/transport/redacted.rb', line 34 def initialize(elements = nil) super() (elements || {}).each_pair { |key, value| self[key] = value } end |
Instance Method Details
#inspect ⇒ String
Get a string representation of the hash.
55 56 57 |
# File 'lib/opensearch/transport/redacted.rb', line 55 def inspect redacted_string(:inspect) end |
#to_s ⇒ String
Get a string representation of the hash.
64 65 66 |
# File 'lib/opensearch/transport/redacted.rb', line 64 def to_s redacted_string(:to_s) end |