this_feature 0.5.0 → 0.5.1

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: b1ce587cdd7e38a631ec48ebec63a3de11bd96ed5c82abff3b4486a0b09c0f11
4
- data.tar.gz: 19643b3951c2483fdf3694073c24cbc71a530997a5192c58ea8a9c835b8c39cf
3
+ metadata.gz: b6fdd8f4258c9cca45bdf31d7370e100eb9175102ba565f3368f23a83edf8d46
4
+ data.tar.gz: 79c1cbce63fad4511b3a5828fcc90cecb609db1abf2047c01270f7246c1631be
5
5
  SHA512:
6
- metadata.gz: 132cb856e2bfb0af4b334bde04a7cce7586a15a3c6a0ffc5a0dde71725cc388deef03b21fc67d1a9f174e950676c832e99b8dbcd7211f187e8864b6918f944c3
7
- data.tar.gz: 16a4c927b80d69a40b5104cb9e7d284c0da6423ddac78c89ce6a9b2394cade377f7c981c51f864c9c3fe506e119894081d6215d60f0273592912fbefa5a3892b
6
+ metadata.gz: b8cb49d96981b3320399c856fcd5367e54fc478c9af60e4bfacbf6d2a54a990fa89db7344e8e1b342cbb2a764e57c7b6ca3f7dddec0247fa6f6521250f40f565
7
+ data.tar.gz: b3804fb6eb9f37a12e2a8a477ed730ca83ed2cdf7d1a419c39b75ba1d9a4d9243051ee292dfdc59a5d68a2cb3a5d901a2606455916a6a0a22f2b73a5aab27c50
data/README.md CHANGED
@@ -63,7 +63,7 @@ These adapters do behave slightly differently, so make sure to read the followin
63
63
 
64
64
  - [Flipper adapter](./docs/flipper.md)
65
65
  - [Split.io adapter](./docs/splitio.md)
66
- - [Memory adapter](./docs/memory.md) - **very helpful to use in tests**
66
+ - [Memory adapter](./docs/memory.md) - **designed for use in tests**
67
67
 
68
68
  ## Development
69
69
 
@@ -1,5 +1,24 @@
1
1
  # ThisFeature - Memory Adapter
2
2
 
3
+ ## Synopsis
4
+
5
+ Under the hood, the memory adapter stores data in a dictionary like so:
6
+
7
+ ```
8
+ {
9
+ some_flag_name: {
10
+ global: false,
11
+ contexts: {
12
+ User1: true,
13
+ User2: false
14
+ }
15
+ }
16
+ }
17
+ ```
18
+
19
+ Since it doesn't require actual DB lookups, it's faster, and works well for use
20
+ in test suites.
21
+
3
22
  ## Installation
4
23
 
5
24
  This adapter is included with the core gem:
@@ -16,9 +35,9 @@ require 'this_feature'
16
35
  require 'this_feature/adapters/memory'
17
36
 
18
37
  ThisFeature.configure do |config|
19
- adapter = ThisFeature::Adapters::Memory.new
20
- config.adapters = [adapter]
21
- config.default_adapter = adapter
38
+ config.test_adapter = ThisFeature::Adapters::Memory.new
39
+ config.adapters = [config.test_adapter]
40
+ config.default_adapter = config.test_adapter
22
41
  end
23
42
  ```
24
43
 
@@ -26,8 +45,9 @@ The initializer takes an optional `context_key_method` argument. This is only re
26
45
  it specifies a method name which should be called on the context object to determine its identity.
27
46
  For example:
28
47
 
29
- ```
30
- # Say you have this method which you want to use as the "identity" of a context object:
48
+ ```ruby
49
+ # Say you have this method which you want to use as the "identity"
50
+ # of a context object (e.g. imagine this module is included onto User)
31
51
  module FeatureFlaggable
32
52
  def this_feature_id
33
53
  "#{self.class}-#{self.id}"
@@ -48,7 +68,8 @@ The `context` argument is supported, but not `data`.
48
68
 
49
69
  Read the following notes as well:
50
70
 
51
- - **on?** / **off?**: Under the hood, calls `flipper_id` method on the `context`, if one was given.
71
+ - **on?** / **off?**: If passed a `context` argument, uses the aformentioned logic
72
+ (`context_key_method`) to determine how it's handled.
52
73
 
53
74
  - **control?** is not yet implemented
54
75
 
@@ -60,6 +81,6 @@ Usage example of these:
60
81
 
61
82
  ```
62
83
  # If you have configured the in-memory adapter as the default
63
- ThisFeature.default_adapter.on!(:flag_name, context: user) # with context
64
- ThisFeature.default_adapter.off!(:flag_name) # without context
84
+ ThisFeature.test_adapter.on!(:flag_name, context: user) # with context
85
+ ThisFeature.test_adapter.off!(:flag_name) # without context
65
86
  ```
@@ -0,0 +1,35 @@
1
+ # ThisFeature - Split Adapter
2
+
3
+ ## Installation
4
+
5
+ ```ruby
6
+ gem 'this_feature-adapters-split-io
7
+ ```
8
+
9
+ ## Configuration
10
+
11
+ ```ruby
12
+ # config/initializers/this_feature.rb
13
+ require 'this_feature'
14
+ require 'this_feature/adapters/split_io'
15
+
16
+ ThisFeature.configure do |config|
17
+ adapter = ThisFeature::Adapters::SplitIo.new
18
+ config.adapters = [adapter]
19
+ config.default_adapter = adapter
20
+ end
21
+ ```
22
+
23
+ An existing Split client can be optionally passed to the initializer:
24
+
25
+ ```
26
+ ThisFeature::Adapters::SplitIo.new(client: my_existing_client)
27
+ ```
28
+
29
+ ## API
30
+
31
+ The SplitIo adapter supports the public API of `ThisFeature`.
32
+
33
+ Both `context` and `data` are supported.
34
+
35
+ `control` is a native Split feature, so we perform a query to Split to get this info.
@@ -1,3 +1,3 @@
1
1
  class ThisFeature
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.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.5.0
4
+ version: 0.5.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: 2020-09-25 00:00:00.000000000 Z
11
+ date: 2020-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler