this_feature 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 969159045580ea9f6117ccef0054dc95c9cd2e2d93e96d607cff03721ee017ea
4
- data.tar.gz: 912ad44c5f32cdf932cae4b914fed37df1ae6f496c557f03594a15b7b77b74ac
3
+ metadata.gz: 03e205e9b9a6a53ff76d8c93b315eb7e8cd2f05a96a9e7f4ae9ac434371155e9
4
+ data.tar.gz: 1e5e996c866d55076f205a47685e295e4b04f0373aa545d183c0192d640ac8a0
5
5
  SHA512:
6
- metadata.gz: e3541f52fd4314a25583f611b6cd33be4e6d9fd4e948e8dc0c0fc4158f8355a0d712bf8c5d4c6e840e6e53ffa904a4d0feb6f54e56d26546c26a9dcf2f77e1ef
7
- data.tar.gz: d1b0ad6542b7971cfaae7b56047df473fa0ea5ece1793fa15f132f8a582e0b1b1d59ffe9949b213c5a8b8dd6a870f0e8f2c0e005c954c74ac5121366e209aee7
6
+ metadata.gz: 4ea504d76f8f435166ba50bb4643065030e40ea44626ffd4222fe60a5f80588d3242fe89dc339b14cce7b8cc1657fef016c9c59e5decdc9879f3bf64f23581b5
7
+ data.tar.gz: 523abe2a99278d2c559931e3b89ba0a946ca03f5e7a3fc92fd0e060555d0a0b25308d863f57904f4f4cc9ddb5fd93535e79bcee9164cff769b3d2ee61a6fcf0c
data/Gemfile.lock CHANGED
@@ -1,32 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- this_feature (0.6.0)
5
- this_feature-adapters-flipper (0.6.0)
4
+ this_feature (0.6.1)
5
+ this_feature-adapters-flipper (0.6.1)
6
6
  flipper (~> 0.16)
7
7
  flipper-active_record (~> 0.16)
8
8
  this_feature
9
- this_feature-adapters-split_io (0.6.0)
9
+ this_feature-adapters-split_io (0.6.1)
10
10
  splitclient-rb
11
11
  this_feature
12
12
 
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activemodel (6.0.3.2)
17
- activesupport (= 6.0.3.2)
18
- activerecord (6.0.3.2)
19
- activemodel (= 6.0.3.2)
20
- activesupport (= 6.0.3.2)
21
- activesupport (6.0.3.2)
16
+ activemodel (6.1.3)
17
+ activesupport (= 6.1.3)
18
+ activerecord (6.1.3)
19
+ activemodel (= 6.1.3)
20
+ activesupport (= 6.1.3)
21
+ activesupport (6.1.3)
22
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
- i18n (>= 0.7, < 2)
24
- minitest (~> 5.1)
25
- tzinfo (~> 1.1)
26
- zeitwerk (~> 2.2, >= 2.2.2)
23
+ i18n (>= 1.6, < 2)
24
+ minitest (>= 5.1)
25
+ tzinfo (~> 2.0)
26
+ zeitwerk (~> 2.3)
27
27
  byebug (11.1.2)
28
28
  coderay (1.1.2)
29
- concurrent-ruby (1.1.6)
29
+ concurrent-ruby (1.1.8)
30
30
  connection_pool (2.2.3)
31
31
  database_cleaner (1.8.4)
32
32
  database_cleaner-active_record (1.8.0)
@@ -44,13 +44,13 @@ GEM
44
44
  flipper (~> 0.20.3)
45
45
  gem-release (2.2.1)
46
46
  hitimes (1.3.1)
47
- i18n (1.8.5)
47
+ i18n (1.8.9)
48
48
  concurrent-ruby (~> 1.0)
49
49
  json (2.5.1)
50
50
  jwt (2.2.2)
51
51
  lru_redux (1.1.0)
52
52
  method_source (1.0.0)
53
- minitest (5.14.1)
53
+ minitest (5.14.4)
54
54
  multipart-post (2.1.1)
55
55
  net-http-persistent (4.0.1)
56
56
  connection_pool (~> 2.2)
@@ -78,7 +78,7 @@ GEM
78
78
  ruby2_keywords (0.0.4)
79
79
  socketry (0.5.1)
80
80
  hitimes (~> 1.2)
81
- splitclient-rb (7.2.2)
81
+ splitclient-rb (7.2.3)
82
82
  concurrent-ruby (~> 1.0)
83
83
  faraday (>= 0.8)
84
84
  json (>= 1.8)
@@ -90,9 +90,9 @@ GEM
90
90
  thread_safe (>= 0.3)
91
91
  sqlite3 (1.4.2)
92
92
  thread_safe (0.3.6)
93
- tzinfo (1.2.7)
94
- thread_safe (~> 0.1)
95
- zeitwerk (2.4.0)
93
+ tzinfo (2.0.4)
94
+ concurrent-ruby (~> 1.0)
95
+ zeitwerk (2.4.2)
96
96
 
97
97
  PLATFORMS
98
98
  ruby
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
- ```json
7
+ ```ruby
8
8
  {
9
9
  some_flag_name: {
10
10
  global: false,
@@ -41,7 +41,7 @@ ThisFeature.configure do |config|
41
41
  end
42
42
  ```
43
43
 
44
- The initializer takes an optional `context_key_method` argument. This is only relevant when using `context` -
44
+ The initializer takes an optional `context_key_method` argument. This is only relevant when using `context` -
45
45
  it specifies a method name which should be called on the context object to determine its identity.
46
46
  For example:
47
47
 
@@ -66,19 +66,11 @@ If this option is ommitted, then the context object uses its `self` as its "iden
66
66
 
67
67
  The Memory adapter supports the public API of `ThisFeature`.
68
68
 
69
- The `context` argument is supported, but not `data`.
70
-
71
- Read the following notes as well:
69
+ ### **#on? / #off?**
72
70
 
73
- - **on?** / **off?**: If passed a `context` argument, uses the aformentioned logic
71
+ If passed a `context` argument, uses the aformentioned logic
74
72
  (`context_key_method`) to determine how it's handled.
75
73
 
76
- - **control?** is not yet implemented
77
-
78
- We also support two additional methods here that aren't present on the main adapter yet:
79
-
80
- - **on!** / **off!**
81
-
82
74
  Usage example of these:
83
75
 
84
76
  ```ruby
@@ -86,3 +78,11 @@ Usage example of these:
86
78
  ThisFeature.test_adapter.on!(:flag_name, context: user) # with context
87
79
  ThisFeature.test_adapter.off!(:flag_name) # without context
88
80
  ```
81
+
82
+ ### **#clear**
83
+
84
+ Since the memory adapter stores flags in memory, it won't automatically get cleaned up in your tests. You can use this method to reset the memory adapter state.
85
+
86
+ ```ruby
87
+ ThisFeature.test_adapter.clear
88
+ ```
@@ -31,6 +31,10 @@ class ThisFeature
31
31
  !on?(flag_name, context: context, data: data)
32
32
  end
33
33
 
34
+ def control?(flag_name, **kwargs)
35
+ !present?(flag_name)
36
+ end
37
+
34
38
  def on!(flag_name, context: nil, data: {})
35
39
  storage[flag_name] ||= {}
36
40
 
@@ -1,3 +1,3 @@
1
1
  class ThisFeature
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Pleaner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler