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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1388daa77d143c2822f15642b375b1e833a893d86677337d0d8bfc88875b364c
4
- data.tar.gz: 2e71adb4fdc958bd8793515dbb3317652d9e811166678e7e38c57e57a85f3a08
3
+ metadata.gz: 44b91bbae760e03c60cedc5e14bebc275a4e0fd112ba20bed4c2539016cc8241
4
+ data.tar.gz: 15cfdaa8da6474bd7f6854339aa4123a02991eac0eac8bd3b4d78da3f4d131e9
5
5
  SHA512:
6
- metadata.gz: a3ab6ee23fabf6375facb994ed3a16de3ec21ec53c88da0121fe3158d9b6552127d081124bb02870ca0b04d47bd2df4a79b7a95c45d8991095e2a4cbdfc63d09
7
- data.tar.gz: ae04e209088f84ccb2760f0dc5fc3760cfb25e2ecd452201cf16b5432e4761acd63ef9471fc87cf88e21a1d16ce744191ea7ed6a445b2544fcf3e3a0f2f1040a
6
+ metadata.gz: 3dc592f13f48e806ae7ac7f5985ce4466f7dff80f6965e8a5e0f5df774f4f7529e83023c0cde3a7ad2686d18a4aebab38e8538467576c8b17145c373648382e7
7
+ data.tar.gz: 3fa007054bb09b32ae6df99570683dc568a35365f44f46375f50a9b0a8338640d281dcb37dc6bc6041013093df0f64cb44a42b44c30e8a6e5ee49b0a8291e880
@@ -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
- reported_key = "#{key}_#{response.nil? ? '::null::' : response}"
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 = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostHog
4
- VERSION = '3.9.1'
4
+ VERSION = '3.9.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posthog-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.1
4
+ version: 3.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''