this_feature 0.5.1 → 0.5.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/docs/memory.md +4 -2
- data/docs/writing_an_adapter.md +9 -1
- data/lib/this_feature/adapters/flipper.rb +1 -7
- data/lib/this_feature/configuration.rb +2 -0
- data/lib/this_feature/errors.rb +2 -2
- data/lib/this_feature/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8701f96d9d544b0fa0202e0a0a53df8002ae7d72029758fdb8d19fc23782eb2a
|
4
|
+
data.tar.gz: d9a5b268e601e61229c14174773f0de0b251c60b79ef7f13261fd39933d0df82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ee49f04c5e8d234351fc46b8ad248f0ec546b3ae11506071549f985a3032e0def6cb6992c8c442ff6cba2f07fff1fb154b05969f255c3d6f181a8a9244a3d86
|
7
|
+
data.tar.gz: 874a68f8416dd2f164f0104a3072ccb4fbb1f81a4f2156f5f8253ecee0c8d5cf7318aa8d1d6c6c1b8fa33a8427f77522c8e2316f1250c78a6e4fa07da5e89836
|
data/docs/memory.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Under the hood, the memory adapter stores data in a dictionary like so:
|
6
6
|
|
7
|
-
```
|
7
|
+
```json
|
8
8
|
{
|
9
9
|
some_flag_name: {
|
10
10
|
global: false,
|
@@ -60,6 +60,8 @@ ThisFeature::Adapters::Memory.new(context_key_method: :this_feature_id)
|
|
60
60
|
|
61
61
|
If this option is ommitted, then the context object uses its `self` as its "identity".
|
62
62
|
|
63
|
+
**See below for example of how to use on! and off! from tests**
|
64
|
+
|
63
65
|
## API
|
64
66
|
|
65
67
|
The Memory adapter supports the public API of `ThisFeature`.
|
@@ -79,7 +81,7 @@ We also support two additional methods here that aren't present on the main adap
|
|
79
81
|
|
80
82
|
Usage example of these:
|
81
83
|
|
82
|
-
```
|
84
|
+
```ruby
|
83
85
|
# If you have configured the in-memory adapter as the default
|
84
86
|
ThisFeature.test_adapter.on!(:flag_name, context: user) # with context
|
85
87
|
ThisFeature.test_adapter.off!(:flag_name) # without context
|
data/docs/writing_an_adapter.md
CHANGED
@@ -1 +1,9 @@
|
|
1
|
-
|
1
|
+
Look at [lib/this_feature/adapters/base.rb](../lib/this_feature/adapters/base.rb) to see the methods that your class should implement.
|
2
|
+
|
3
|
+
Make sure your class inherits from `ThisFeature::Adapters::Base` - this is a requirement.
|
4
|
+
|
5
|
+
You may define a custom `initialize` method - this isn't used by `this_feature` internals because we require an already-constructed instance to be passed into `ThisFeature.configure`.
|
6
|
+
|
7
|
+
For an example, look at one of the existing adapters: [lib/this_feature/adapters/](../lib/this_feature/adapters/)
|
8
|
+
|
9
|
+
If you want to include your adapter in our README, just open up a PR.
|
@@ -19,17 +19,11 @@ class ThisFeature
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def on?(flag_name, context: nil, data: {})
|
22
|
-
return unless present?(flag_name)
|
23
|
-
|
24
22
|
client[flag_name].enabled?(*[context].compact)
|
25
23
|
end
|
26
24
|
|
27
25
|
def off?(flag_name, context: nil, data: {})
|
28
|
-
|
29
|
-
|
30
|
-
return if on_result.nil?
|
31
|
-
|
32
|
-
!on_result
|
26
|
+
!on?(flag_name, context: context)
|
33
27
|
end
|
34
28
|
|
35
29
|
private
|
data/lib/this_feature/errors.rb
CHANGED
@@ -14,9 +14,9 @@ class ThisFeature
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
class
|
17
|
+
class NoAdaptersError < Error
|
18
18
|
def initialize
|
19
|
-
super("
|
19
|
+
super("No adapters configured.")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/lib/this_feature/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: this_feature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Pleaner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|