Class: LaunchDarkly::Impl::ContextFilter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ldclient-rb/impl/context_filter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0

Instance Method Summary collapse

Constructor Details

#initialize(all_attributes_private, private_attributes, logger = nil) ⇒ ContextFilter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ContextFilter.

Parameters:

  • all_attributes_private (Boolean)
  • private_attributes (Array<String>)
  • logger (Logger, nil) (defaults to: nil)

Since:

  • 5.5.0



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ldclient-rb/impl/context_filter.rb', line 11

def initialize(all_attributes_private, private_attributes, logger = nil)
  @all_attributes_private = all_attributes_private
  @logger = logger
  @non_symbol_name_logged = Concurrent::AtomicBoolean.new(false)

  @private_attributes = []
  private_attributes.each do |attribute|
    reference = LaunchDarkly::Reference.create(attribute)
    @private_attributes << reference if reference.error.nil?
  end
end

Instance Method Details

#filter(context) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a hash representation of the provided context with attribute redaction applied.

Parameters:

Returns:

  • (Hash)

Since:

  • 5.5.0



30
31
32
# File 'lib/ldclient-rb/impl/context_filter.rb', line 30

def filter(context)
  internal_filter(context, false)
end

#filter_redact_anonymous(context) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a hash representation of the provided context with attribute redaction applied.

If a context is anonyomous, all attributes will be redacted except for key, kind, and anonymous.

Parameters:

Returns:

  • (Hash)

Since:

  • 5.5.0



44
45
46
# File 'lib/ldclient-rb/impl/context_filter.rb', line 44

def filter_redact_anonymous(context)
  internal_filter(context, true)
end