-
-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
module Flipper | ||
module Adapters | ||
module Poolable | ||
def initialize(client_or_pool = nil, key_prefix: nil) | ||
@pool = nil | ||
@client = nil | ||
if client_or_pool.respond_to?(:with) | ||
@pool = client_or_pool | ||
else | ||
@client = client_or_pool | ||
end | ||
@key_prefix = key_prefix | ||
end | ||
|
||
def self.included(klass) | ||
klass.superclass.instance_methods(false).each do |method| | ||
klass.define_method method do |*args| | ||
return super(*args) unless @client.nil? | ||
|
||
@pool.with do |client| | ||
@client = client | ||
super(*args).tap { @client = nil } | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
This file was deleted.
This file was deleted.