flipper 0.24.0 → 0.24.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: f74cad5c410ce4146e29c11d692fb97d500c54301af8dab6b1c4b0da95ae79c8
4
- data.tar.gz: 5e6f5613ea2166f1899e553601c555a87b9f47de169ef45b5f19c0d3aa77b3c9
3
+ metadata.gz: a73ea66b4ab3342f5cf63a162bf8b0482fdc644dc0fff38fcb2d3fa2b39015be
4
+ data.tar.gz: a680008dad6bc0affee30e0d150aab5cc869d46d37ac2ae3ce8b7b2f57de9e9b
5
5
  SHA512:
6
- metadata.gz: 44f19778f0d3e35f99b909b4bd2fa2603b596b4cff77eb70d806c73453c1a1cf4a3d79ddf5c4ef593464099134505507152e1f392174f525e4815d5ca5592371
7
- data.tar.gz: e999db32f892bbbf307c38f65b98b149489c830ba1b2530f2f5d308b837eb8a4d5d1f49f95242047d989e93b253a0599df8929fece5d78a9d959a2cad9dfac52
6
+ metadata.gz: 50d1ff58301b4040e2ac0ed6590c057952f3c926aa88371858cec083be2d5fcdb17920fa120f6c59f9a5625ad2260aa0cdf40c26dfa64239a4790f247287c720
7
+ data.tar.gz: 40d68ac75fde3051cece778aa09145891ca3cf289abb795c66695f3e3fac569c28e81864d3be386d7ab03d0fd9c1b9c303fca6f5865ef6a2cd4eb9edbdc12eee
data/Changelog.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.24.1
2
+
3
+ ### Additions/Changes
4
+
5
+ * flipper-api: `exclude_gates` parameter to exclude gate data in GETs (https://github.com/jnunemaker/flipper/pull/572).
6
+ * Make it possible to disable internal memoization (https://github.com/jnunemaker/flipper/pull/612).
7
+ * Add Flipper::Actor#hash so actors can be hash keys (https://github.com/jnunemaker/flipper/pull/616).
8
+ * Pretty Up `rails routes` again and make rack-protection dependency less strict (https://github.com/jnunemaker/flipper/pull/619).
9
+ * Add kwargs for method_missing using ruby 3.0 (https://github.com/jnunemaker/flipper/pull/620).
10
+
1
11
  ## 0.24.0
2
12
 
3
13
  ### Additions/Changes
@@ -6,7 +16,7 @@
6
16
  * Removed support for Ruby 2.5 (which was end of line 9 months ago)
7
17
  * Add (alpha) client side instrumentation of events to cloud (https://github.com/jnunemaker/flipper/pull/602)
8
18
  * Fix deprecated uses of Redis#pipelined (https://github.com/jnunemaker/flipper/pull/603). redis-rb >= 3 now required.
9
- * Fix Flipper UI Rack application when `Rack::Session::Pool` is used to build it.
19
+ * Fix Flipper UI Rack application when `Rack::Session::Pool` is used to build it (https://github.com/jnunemaker/flipper/pull/606).
10
20
 
11
21
  ## 0.23.1
12
22
 
data/lib/flipper/actor.rb CHANGED
@@ -12,5 +12,9 @@ module Flipper
12
12
  self.class.eql?(other.class) && @flipper_id == other.flipper_id
13
13
  end
14
14
  alias_method :==, :eql?
15
+
16
+ def hash
17
+ flipper_id.hash
18
+ end
15
19
  end
16
20
  end
data/lib/flipper/dsl.rb CHANGED
@@ -17,10 +17,12 @@ module Flipper
17
17
  # adapter - The adapter that this DSL instance should use.
18
18
  # options - The Hash of options.
19
19
  # :instrumenter - What should be used to instrument all the things.
20
+ # :memoize - Should adapter be wrapped by memoize adapter or not.
20
21
  def initialize(adapter, options = {})
21
22
  @instrumenter = options.fetch(:instrumenter, Instrumenters::Noop)
22
- memoized = Adapters::Memoizable.new(adapter)
23
- @adapter = memoized
23
+ memoize = options.fetch(:memoize, true)
24
+ adapter = Adapters::Memoizable.new(adapter) if memoize
25
+ @adapter = adapter
24
26
  @memoized_features = {}
25
27
  end
26
28
 
@@ -23,8 +23,14 @@ module Flipper
23
23
  super || @thing.respond_to?(*args)
24
24
  end
25
25
 
26
- def method_missing(name, *args, &block)
27
- @thing.send name, *args, &block
26
+ if RUBY_VERSION >= '3.0'
27
+ def method_missing(name, *args, **kwargs, &block)
28
+ @thing.send name, *args, **kwargs, &block
29
+ end
30
+ else
31
+ def method_missing(name, *args, &block)
32
+ @thing.send name, *args, &block
33
+ end
28
34
  end
29
35
  end
30
36
  end
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.24.0'.freeze
2
+ VERSION = '0.24.1'.freeze
3
3
  end
@@ -43,4 +43,14 @@ RSpec.describe Flipper::Actor do
43
43
  expect(actor1.==(actor2)).to be(false)
44
44
  end
45
45
  end
46
+
47
+ describe '#hash' do
48
+ it 'returns a hash-value based on the flipper id' do
49
+ h = {
50
+ described_class.new("User;123") => true
51
+ }
52
+ expect(h).to have_key(described_class.new("User;123"))
53
+ expect(h).not_to have_key(described_class.new("User;456"))
54
+ end
55
+ end
46
56
  end
@@ -6,9 +6,19 @@ RSpec.describe Flipper::DSL do
6
6
  let(:adapter) { Flipper::Adapters::Memory.new }
7
7
 
8
8
  describe '#initialize' do
9
- it 'sets adapter' do
10
- dsl = described_class.new(adapter)
11
- expect(dsl.adapter).not_to be_nil
9
+ context 'when using default memoize strategy' do
10
+ it 'wraps the given adapter with Flipper::Adapters::Memoizable' do
11
+ dsl = described_class.new(adapter)
12
+ expect(dsl.adapter.class).to be(Flipper::Adapters::Memoizable)
13
+ expect(dsl.adapter.adapter).to be(adapter)
14
+ end
15
+ end
16
+
17
+ context 'when disabling memoization' do
18
+ it 'uses the given adapter directly' do
19
+ dsl = described_class.new(adapter, memoize: false)
20
+ expect(dsl.adapter).to be(adapter)
21
+ end
12
22
  end
13
23
 
14
24
  it 'defaults instrumenter to noop' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.24.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-17 00:00:00.000000000 Z
11
+ date: 2022-04-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: