Class: LaunchDarkly::Impl::ContextFilter
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::ContextFilter
- Defined in:
- lib/ldclient-rb/impl/context_filter.rb
Overview
Instance Method Summary collapse
-
#filter(context) ⇒ Hash
Return a hash representation of the provided context with attribute redaction applied.
-
#filter_redact_anonymous(context) ⇒ Hash
Return a hash representation of the provided context with attribute redaction applied.
-
#initialize(all_attributes_private, private_attributes) ⇒ ContextFilter
constructor
A new instance of ContextFilter.
Constructor Details
#initialize(all_attributes_private, private_attributes) ⇒ ContextFilter
Returns a new instance of ContextFilter.
8 9 10 11 12 13 14 15 16 |
# File 'lib/ldclient-rb/impl/context_filter.rb', line 8 def initialize(all_attributes_private, private_attributes) @all_attributes_private = all_attributes_private @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
Return a hash representation of the provided context with attribute redaction applied.
25 26 27 |
# File 'lib/ldclient-rb/impl/context_filter.rb', line 25 def filter(context) internal_filter(context, false) end |
#filter_redact_anonymous(context) ⇒ Hash
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.
39 40 41 |
# File 'lib/ldclient-rb/impl/context_filter.rb', line 39 def filter_redact_anonymous(context) internal_filter(context, true) end |