Class: PostHog::SendFeatureFlagsOptions Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/posthog/send_feature_flags_options.rb

Overview

Deprecated.

Prefer passing a FeatureFlagEvaluations snapshot to ‘capture(flags:)`.

Options for configuring deprecated feature flag behavior in capture calls.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(only_evaluate_locally: nil, person_properties: nil, group_properties: nil) ⇒ SendFeatureFlagsOptions

Returns a new instance of SendFeatureFlagsOptions.

Parameters:

  • only_evaluate_locally (Boolean, nil) (defaults to: nil)

    Skip remote feature flag evaluation.

  • person_properties (Hash, nil) (defaults to: nil)

    Person properties to use for feature flag evaluation.

  • group_properties (Hash, nil) (defaults to: nil)

    Group properties to use for feature flag evaluation.



22
23
24
25
26
# File 'lib/posthog/send_feature_flags_options.rb', line 22

def initialize(only_evaluate_locally: nil, person_properties: nil, group_properties: nil)
  @only_evaluate_locally = only_evaluate_locally
  @person_properties = person_properties || {}
  @group_properties = group_properties || {}
end

Instance Attribute Details

#group_propertiesHash (readonly)

Returns Group properties to use for feature flag evaluation.

Returns:

  • (Hash)

    Group properties to use for feature flag evaluation.



17
18
19
# File 'lib/posthog/send_feature_flags_options.rb', line 17

def group_properties
  @group_properties
end

#only_evaluate_locallyBoolean? (readonly)

Returns Whether remote feature flag evaluation should be skipped.

Returns:

  • (Boolean, nil)

    Whether remote feature flag evaluation should be skipped.



11
12
13
# File 'lib/posthog/send_feature_flags_options.rb', line 11

def only_evaluate_locally
  @only_evaluate_locally
end

#person_propertiesHash (readonly)

Returns Person properties to use for feature flag evaluation.

Returns:

  • (Hash)

    Person properties to use for feature flag evaluation.



14
15
16
# File 'lib/posthog/send_feature_flags_options.rb', line 14

def person_properties
  @person_properties
end

Class Method Details

.from_hash(hash) ⇒ PostHog::SendFeatureFlagsOptions?

Parameters:

  • hash (Hash)

Returns:



39
40
41
42
43
44
45
46
47
# File 'lib/posthog/send_feature_flags_options.rb', line 39

def self.from_hash(hash)
  return nil unless hash.is_a?(Hash)

  new(
    only_evaluate_locally: PostHog::Utils.get_by_symbol_or_string_key(hash, :only_evaluate_locally),
    person_properties: PostHog::Utils.get_by_symbol_or_string_key(hash, :person_properties),
    group_properties: PostHog::Utils.get_by_symbol_or_string_key(hash, :group_properties)
  )
end

Instance Method Details

#to_hHash

Returns A hash representation suitable for ‘capture(send_feature_flags:)`.

Returns:

  • (Hash)

    A hash representation suitable for ‘capture(send_feature_flags:)`.



29
30
31
32
33
34
35
# File 'lib/posthog/send_feature_flags_options.rb', line 29

def to_h
  {
    only_evaluate_locally: @only_evaluate_locally,
    person_properties: @person_properties,
    group_properties: @group_properties
  }
end