unleash 4.4.1 → 4.4.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: e7e1d111b5560a8236c52c1b1744f32724fdd0b26d02af16da707efe2869be3e
4
- data.tar.gz: 402580857880d3508ad7b46afbc47b74c696bb6ad5360a48e4254f35ecd48f05
3
+ metadata.gz: e8461b30f4a58518d73731731a7dfbc32041a5a017362319b9d8ba76d2cecb98
4
+ data.tar.gz: '06098a3f106f50b0ddad46e17bef57584918ecbefe88486009d95edbdb546550'
5
5
  SHA512:
6
- metadata.gz: ed380682c17c90cea0d8b79ba7b05f20b053eb20fd3d293f93e3b2356a264ab386fcee3b91b6ec6507965fb23e922f1e9d50cae2bd880973d9111413abda0572
7
- data.tar.gz: 0ba69ee86b9dc60e65aac73023e9e39c1a93d56579fee7c3f990d4e944259a879ba66058e8614cc41c9dc22a41cc4ab5bf8824e7db24d3e8a5cbc8b5c4fcb4cb
6
+ metadata.gz: ec0644f3bd93de7f75b06e44c059d39ff3ed87af00ee7ca17d1ad3a3e444626f190c4e26863167b116eda85ce0c01196542f8167f4494052fdae9b3e3e09e15c
7
+ data.tar.gz: 11764caf8ccd33c757cbd282a5e5f3d6d6b9dc7b70c29c0e9e196b512be3c1baee10abb21279358e7c7001a91b3825d5c42661910695e74e9e1585e2003c9b58
@@ -31,6 +31,7 @@ jobs:
31
31
  - jruby-9.4
32
32
  - jruby-9.3
33
33
  - jruby-9.2
34
+ - 3.2
34
35
  - 3.1
35
36
  - '3.0'
36
37
  - 2.7
data/.rubocop.yml CHANGED
@@ -6,6 +6,7 @@ AllCops:
6
6
  Naming/PredicateName:
7
7
  AllowedMethods:
8
8
  - is_enabled?
9
+ - is_disabled?
9
10
 
10
11
 
11
12
  Metrics/ClassLength:
data/README.md CHANGED
@@ -10,6 +10,7 @@ Leverage the [Unleash Server](https://github.com/Unleash/unleash) for powerful f
10
10
 
11
11
  ## Supported Ruby Interpreters
12
12
 
13
+ * MRI 3.2
13
14
  * MRI 3.1
14
15
  * MRI 3.0
15
16
  * MRI 2.7
@@ -124,6 +125,12 @@ if @unleash.is_enabled?(feature_name, unleash_context)
124
125
  else
125
126
  puts " #{feature_name} is disabled according to unleash"
126
127
  end
128
+
129
+ if @unleash.is_disabled?(feature_name, unleash_context)
130
+ puts " #{feature_name} is disabled according to unleash"
131
+ else
132
+ puts " #{feature_name} is enabled according to unleash"
133
+ end
127
134
  ```
128
135
 
129
136
  ## Usage in a Rails Application
@@ -303,6 +310,9 @@ Then wherever in your application that you need a feature toggle, you can use:
303
310
  if UNLEASH.is_enabled? "AwesomeFeature", @unleash_context
304
311
  puts "AwesomeFeature is enabled"
305
312
  end
313
+ if UNLEASH.is_disabled? "AwesomeFeature", @unleash_context
314
+ puts "AwesomeFeature is disabled"
315
+ end
306
316
  ```
307
317
 
308
318
  or if client is set in `Rails.configuration.unleash`:
@@ -311,6 +321,9 @@ or if client is set in `Rails.configuration.unleash`:
311
321
  if Rails.configuration.unleash.is_enabled? "AwesomeFeature", @unleash_context
312
322
  puts "AwesomeFeature is enabled"
313
323
  end
324
+ if Rails.configuration.unleash.is_disabled? "AwesomeFeature", @unleash_context
325
+ puts "AwesomeFeature is enabled"
326
+ end
314
327
  ```
315
328
 
316
329
  If the feature is not found in the server, it will by default return false.
@@ -444,6 +457,9 @@ Method Name | Description | Return Type |
444
457
  `is_enabled?` | Check if feature toggle is to be enabled or not. | Boolean |
445
458
  `enabled?` | Alias to the `is_enabled?` method. But more ruby idiomatic. | Boolean |
446
459
  `if_enabled` | Run a code block, if a feature is enabled. | `yield` |
460
+ `is_disabled?` | Check if feature toggle is to be enabled or not. | Boolean |
461
+ `disabled?` | Alias to the `is_disabled?` method. But more ruby idiomatic. | Boolean |
462
+ `if_disabled` | Run a code block, if a feature is disabled. | `yield` |
447
463
  `get_variant` | Get variant for a given feature | `Unleash::Variant` |
448
464
  `shutdown` | Save metrics to disk, flush metrics to server, and then kill ToggleFetcher and MetricsReporter threads. A safe shutdown. Not really useful in long running applications, like web applications. | nil |
449
465
  `shutdown!` | Kill ToggleFetcher and MetricsReporter threads immediately. | nil |
@@ -50,14 +50,25 @@ module Unleash
50
50
  toggle.is_enabled?(context)
51
51
  end
52
52
 
53
+ def is_disabled?(feature, context = nil, default_value_param = true, &fallback_blk)
54
+ !is_enabled?(feature, context, !default_value_param, &fallback_blk)
55
+ end
56
+
53
57
  # enabled? is a more ruby idiomatic method name than is_enabled?
54
58
  alias enabled? is_enabled?
59
+ # disabled? is a more ruby idiomatic method name than is_disabled?
60
+ alias disabled? is_disabled?
55
61
 
56
62
  # execute a code block (passed as a parameter), if is_enabled? is true.
57
63
  def if_enabled(feature, context = nil, default_value = false, &blk)
58
64
  yield(blk) if is_enabled?(feature, context, default_value)
59
65
  end
60
66
 
67
+ # execute a code block (passed as a parameter), if is_disabled? is true.
68
+ def if_disabled(feature, context = nil, default_value = true, &blk)
69
+ yield(blk) if is_disabled?(feature, context, default_value)
70
+ end
71
+
61
72
  def get_variant(feature, context = Unleash::Context.new, fallback_variant = disabled_variant)
62
73
  Unleash.logger.debug "Unleash::Client.get_variant for feature: #{feature} with context #{context}"
63
74
 
@@ -1,3 +1,3 @@
1
1
  module Unleash
2
- VERSION = "4.4.1".freeze
2
+ VERSION = "4.4.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unleash
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.1
4
+ version: 4.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renato Arruda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-07 00:00:00.000000000 Z
11
+ date: 2023-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: murmurhash3