posthog-ruby 3.9.1 → 3.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/posthog/client.rb +13 -1
- data/lib/posthog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44b91bbae760e03c60cedc5e14bebc275a4e0fd112ba20bed4c2539016cc8241
|
|
4
|
+
data.tar.gz: 15cfdaa8da6474bd7f6854339aa4123a02991eac0eac8bd3b4d78da3f4d131e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3dc592f13f48e806ae7ac7f5985ce4466f7dff80f6965e8a5e0f5df774f4f7529e83023c0cde3a7ad2686d18a4aebab38e8538467576c8b17145c373648382e7
|
|
7
|
+
data.tar.gz: 3fa007054bb09b32ae6df99570683dc568a35365f44f46375f50a9b0a8338640d281dcb37dc6bc6041013093df0f64cb44a42b44c30e8a6e5ee49b0a8291e880
|
data/lib/posthog/client.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'time'
|
|
4
|
+
require 'json'
|
|
4
5
|
require 'securerandom'
|
|
5
6
|
|
|
6
7
|
require 'posthog/defaults'
|
|
@@ -760,11 +761,22 @@ module PostHog
|
|
|
760
761
|
# Shared by the legacy single-flag path ({#get_feature_flag_result}) and the
|
|
761
762
|
# snapshot's access-recording. Owns dedup-key construction, the
|
|
762
763
|
# per-distinct_id sent-flags cache, and the `$feature_flag_called` capture call.
|
|
764
|
+
# Group context is included in the dedup key so group-scoped flags fire a
|
|
765
|
+
# separate event for each group a user is evaluated under.
|
|
763
766
|
def _capture_feature_flag_called_if_needed(
|
|
764
767
|
distinct_id: nil, key: nil, response: nil, properties: nil,
|
|
765
768
|
groups: nil, disable_geoip: nil
|
|
766
769
|
)
|
|
767
|
-
|
|
770
|
+
response_repr = response.nil? ? '::null::' : response
|
|
771
|
+
groups_repr =
|
|
772
|
+
if groups && !groups.empty?
|
|
773
|
+
# Canonicalize so two equal hashes with keys inserted in a different
|
|
774
|
+
# order produce the same dedup key.
|
|
775
|
+
"_#{groups.sort.to_json}"
|
|
776
|
+
else
|
|
777
|
+
''
|
|
778
|
+
end
|
|
779
|
+
reported_key = "#{key}_#{response_repr}#{groups_repr}"
|
|
768
780
|
return if @distinct_id_has_sent_flag_calls[distinct_id].include?(reported_key)
|
|
769
781
|
|
|
770
782
|
msg = {
|
data/lib/posthog/version.rb
CHANGED