Class: Flipper::Adapters::Wrapper
- Inherits:
-
Object
- Object
- Flipper::Adapters::Wrapper
- Includes:
- Flipper::Adapter
- Defined in:
- lib/flipper/adapters/wrapper.rb
Overview
A base class for any adapter that wraps another adapter. By default, all methods delegate to the wrapped adapter. Implement ‘#wrap` to customize the behavior of all delegated methods, or override individual methods as needed.
Direct Known Subclasses
Constant Summary collapse
- METHODS =
[ :import, :export, :features, :add, :remove, :clear, :get, :get_multi, :get_all, :enable, :disable, ].freeze
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
Instance Method Summary collapse
-
#initialize(adapter) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #wrap(method, *args, &block) ⇒ Object
Methods included from Flipper::Adapter
#default_config, #export, #get_all, #get_multi, #import, included, #name, #read_only?
Constructor Details
#initialize(adapter) ⇒ Wrapper
Returns a new instance of Wrapper.
25 26 27 |
# File 'lib/flipper/adapters/wrapper.rb', line 25 def initialize(adapter) @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
23 24 25 |
# File 'lib/flipper/adapters/wrapper.rb', line 23 def adapter @adapter end |
Instance Method Details
#wrap(method, *args, &block) ⇒ Object
44 45 46 |
# File 'lib/flipper/adapters/wrapper.rb', line 44 def wrap(method, *args, **kwargs, &block) block.call end |