Module: Featuring::Persistence::Adapter
- Included in:
- ActiveRecord
- Defined in:
- lib/featuring/persistence/adapter.rb
Overview
- public
-
Defines the behavior for feature flag adapters.
Adapters are modules that are extended by Adapter. They must define three methods:
1. `fetch`: Returns persisted feature flag values for a given object.
2. `create`: Creates feature flags for a given object.
3. `update`: Updates feature flags for a given object.
4. `replace`: Replaces feature flags for a given object.
See Featuring::Persistence::ActiveRecord for a complete example.
Defined Under Namespace
Modules: Methods
Instance Method Summary collapse
Instance Method Details
#included(object) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/featuring/persistence/adapter.rb', line 23 def included(object) object.instance_feature_class.prepend Methods object.instance_feature_class.module_exec(self) do |adapter| define_method :feature_flag_adapter do adapter end end # Give adapters the ability to extend the object with persistent flags. # if const_defined?("Flaggable", false) object.prepend(const_get("Flaggable")) end end |