posthog-ruby 3.26.4 → 3.27.0

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: f8ce806f1bb00b10162307764e024a4019e9ea6d924700da5443ad15f430b4c8
4
- data.tar.gz: b810a1652c8615a544fc24082b8e99a34ddf3db96c1605e29e8fc36ff2ae3cc3
3
+ metadata.gz: 9809cd9248724a9b3b032b1f822c7108da7a089330f37bacd1c86d7b614452e2
4
+ data.tar.gz: ca0f1dfcaecfbbaa4cf426ca0ab9eda422dede368cf55e899bb2aeb6e4a5b0ab
5
5
  SHA512:
6
- metadata.gz: 9b58080118c7780408d1f7e7992ef99d1e4a76db837babc8057e09b826a4ef0b2bd4a5a369cbb164fe8675735cd9074a4d9b312f4532198c2415782a3c8cf820
7
- data.tar.gz: 70ea5da7b0cc56c9a96681cc64611e85b931deb63359c64f99507d9bb292b459f1d5c246ba13a8961b28af15e6009fc7338ea6a04f02af74120c05e8e56a65c1
6
+ metadata.gz: 0c291a4b34b4d060bd0f85f0fe9622b5ee209b2f888dfff1b049108a63bc8bb8ee0f302218bffb20e71e31d04561b00dede786bb8dc57bced15d52578ca9a2dd
7
+ data.tar.gz: 8acdfca32f6df2ee0d9330539715bbc1d29b23a14c7ca6d2a458f6f8857d50ea9318d1f2d4c27354967c91abf5cc0ba87519d3255e5be849c5b3e78fd24d232f
@@ -81,11 +81,20 @@ module PostHog
81
81
  end
82
82
 
83
83
  # @param key [String, Symbol] The feature flag key.
84
- # @return [Boolean] true when the flag is enabled, false when disabled or missing.
85
- def enabled?(key)
84
+ # @param default_value [Boolean, nil] Returned when the flag has no value in this
85
+ # snapshot — it was never loaded, the `/flags` request failed, or no flag with that
86
+ # key exists. A flag that does have a value, including `false` and variant strings,
87
+ # always wins over this default; so does a flag the server returned but marked as
88
+ # failed, which resolves to `false`. Defaults to `nil`, which keeps the historical
89
+ # `false` result for a missing flag.
90
+ # @return [Boolean] true when the flag is enabled, false when disabled, and the
91
+ # caller-supplied default (or false when none was supplied) when the flag is missing.
92
+ def enabled?(key, default_value: nil)
86
93
  key = key.to_s
87
94
  flag = @flags[key]
88
95
  _record_access(key, flag)
96
+ return !!default_value if flag.nil? && !default_value.nil?
97
+
89
98
  flag&.enabled ? true : false
90
99
  end
91
100
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostHog
4
- VERSION = '3.26.4'
4
+ VERSION = '3.27.0'
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.26.4
4
+ version: 3.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''